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 | | #include "common/compile_check_begin.h" |
32 | | |
33 | | #define DECIMAL_CONVERT_OVERFLOW_ERROR(value, from_type_name, precision, scale) \ |
34 | 2.14k | Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, \ |
35 | 2.14k | fmt::format( \ |
36 | 2.14k | "Arithmetic overflow when converting value {} from type {} to decimal({}, {})", \ |
37 | 2.14k | value, from_type_name, precision, scale)) |
38 | | struct CastToDecimal { |
39 | | template <typename ToCppT> |
40 | | requires(IsDecimalNumber<ToCppT>) |
41 | | static inline bool from_string(const StringRef& from, ToCppT& to, UInt32 precision, |
42 | 110k | UInt32 scale, CastParameters& params) { |
43 | 110k | if constexpr (IsDecimalV2<ToCppT>) { |
44 | 6 | return StringParser::PARSE_SUCCESS == |
45 | 6 | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); |
46 | 6 | } |
47 | | |
48 | 29.7k | if constexpr (IsDecimal32<ToCppT>) { |
49 | 29.7k | return StringParser::PARSE_SUCCESS == |
50 | 29.7k | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); |
51 | 29.7k | } |
52 | | |
53 | 26.9k | if constexpr (IsDecimal64<ToCppT>) { |
54 | 26.9k | return StringParser::PARSE_SUCCESS == |
55 | 26.9k | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); |
56 | 26.9k | } |
57 | | |
58 | 26.9k | if constexpr (IsDecimal128V3<ToCppT>) { |
59 | 26.9k | return StringParser::PARSE_SUCCESS == |
60 | 26.9k | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); |
61 | 26.9k | } |
62 | | |
63 | 26.8k | if constexpr (IsDecimal256<ToCppT>) { |
64 | 26.8k | return StringParser::PARSE_SUCCESS == |
65 | 26.8k | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); |
66 | 26.8k | } |
67 | 110k | } _ZN5doris13CastToDecimal11from_stringINS_7DecimalIiEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS4_jjRNS_14CastParametersE Line | Count | Source | 42 | 29.7k | UInt32 scale, CastParameters& params) { | 43 | | if constexpr (IsDecimalV2<ToCppT>) { | 44 | | return StringParser::PARSE_SUCCESS == | 45 | | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 46 | | } | 47 | | | 48 | 29.7k | if constexpr (IsDecimal32<ToCppT>) { | 49 | 29.7k | return StringParser::PARSE_SUCCESS == | 50 | 29.7k | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 51 | 29.7k | } | 52 | | | 53 | | if constexpr (IsDecimal64<ToCppT>) { | 54 | | return StringParser::PARSE_SUCCESS == | 55 | | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 56 | | } | 57 | | | 58 | | if constexpr (IsDecimal128V3<ToCppT>) { | 59 | | return StringParser::PARSE_SUCCESS == | 60 | | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 61 | | } | 62 | | | 63 | | if constexpr (IsDecimal256<ToCppT>) { | 64 | | return StringParser::PARSE_SUCCESS == | 65 | | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 66 | | } | 67 | 29.7k | } |
_ZN5doris13CastToDecimal11from_stringINS_7DecimalIlEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS4_jjRNS_14CastParametersE Line | Count | Source | 42 | 26.9k | UInt32 scale, CastParameters& params) { | 43 | | if constexpr (IsDecimalV2<ToCppT>) { | 44 | | return StringParser::PARSE_SUCCESS == | 45 | | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 46 | | } | 47 | | | 48 | | if constexpr (IsDecimal32<ToCppT>) { | 49 | | return StringParser::PARSE_SUCCESS == | 50 | | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 51 | | } | 52 | | | 53 | 26.9k | if constexpr (IsDecimal64<ToCppT>) { | 54 | 26.9k | return StringParser::PARSE_SUCCESS == | 55 | 26.9k | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 56 | 26.9k | } | 57 | | | 58 | | if constexpr (IsDecimal128V3<ToCppT>) { | 59 | | return StringParser::PARSE_SUCCESS == | 60 | | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 61 | | } | 62 | | | 63 | | if constexpr (IsDecimal256<ToCppT>) { | 64 | | return StringParser::PARSE_SUCCESS == | 65 | | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 66 | | } | 67 | 26.9k | } |
_ZN5doris13CastToDecimal11from_stringINS_12Decimal128V3EQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS3_jjRNS_14CastParametersE Line | Count | Source | 42 | 26.9k | UInt32 scale, CastParameters& params) { | 43 | | if constexpr (IsDecimalV2<ToCppT>) { | 44 | | return StringParser::PARSE_SUCCESS == | 45 | | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 46 | | } | 47 | | | 48 | | if constexpr (IsDecimal32<ToCppT>) { | 49 | | return StringParser::PARSE_SUCCESS == | 50 | | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 51 | | } | 52 | | | 53 | | if constexpr (IsDecimal64<ToCppT>) { | 54 | | return StringParser::PARSE_SUCCESS == | 55 | | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 56 | | } | 57 | | | 58 | 26.9k | if constexpr (IsDecimal128V3<ToCppT>) { | 59 | 26.9k | return StringParser::PARSE_SUCCESS == | 60 | 26.9k | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 61 | 26.9k | } | 62 | | | 63 | | if constexpr (IsDecimal256<ToCppT>) { | 64 | | return StringParser::PARSE_SUCCESS == | 65 | | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 66 | | } | 67 | 26.9k | } |
_ZN5doris13CastToDecimal11from_stringINS_14DecimalV2ValueEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS3_jjRNS_14CastParametersE Line | Count | Source | 42 | 6 | UInt32 scale, CastParameters& params) { | 43 | 6 | if constexpr (IsDecimalV2<ToCppT>) { | 44 | 6 | return StringParser::PARSE_SUCCESS == | 45 | 6 | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 46 | 6 | } | 47 | | | 48 | | if constexpr (IsDecimal32<ToCppT>) { | 49 | | return StringParser::PARSE_SUCCESS == | 50 | | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 51 | | } | 52 | | | 53 | | if constexpr (IsDecimal64<ToCppT>) { | 54 | | return StringParser::PARSE_SUCCESS == | 55 | | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 56 | | } | 57 | | | 58 | | if constexpr (IsDecimal128V3<ToCppT>) { | 59 | | return StringParser::PARSE_SUCCESS == | 60 | | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 61 | | } | 62 | | | 63 | | if constexpr (IsDecimal256<ToCppT>) { | 64 | | return StringParser::PARSE_SUCCESS == | 65 | | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 66 | | } | 67 | 6 | } |
_ZN5doris13CastToDecimal11from_stringINS_7DecimalIN4wide7integerILm256EiEEEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS7_jjRNS_14CastParametersE Line | Count | Source | 42 | 26.8k | UInt32 scale, CastParameters& params) { | 43 | | if constexpr (IsDecimalV2<ToCppT>) { | 44 | | return StringParser::PARSE_SUCCESS == | 45 | | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 46 | | } | 47 | | | 48 | | if constexpr (IsDecimal32<ToCppT>) { | 49 | | return StringParser::PARSE_SUCCESS == | 50 | | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 51 | | } | 52 | | | 53 | | if constexpr (IsDecimal64<ToCppT>) { | 54 | | return StringParser::PARSE_SUCCESS == | 55 | | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 56 | | } | 57 | | | 58 | | if constexpr (IsDecimal128V3<ToCppT>) { | 59 | | return StringParser::PARSE_SUCCESS == | 60 | | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 61 | | } | 62 | | | 63 | 26.8k | if constexpr (IsDecimal256<ToCppT>) { | 64 | 26.8k | return StringParser::PARSE_SUCCESS == | 65 | 26.8k | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 66 | 26.8k | } | 67 | 26.8k | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal11from_stringINS_7DecimalInEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS4_jjRNS_14CastParametersE |
68 | | |
69 | | // cast int to decimal |
70 | | template <typename FromCppT, typename ToCppT, |
71 | | typename MaxNativeType = |
72 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
73 | | FromCppT, typename ToCppT::NativeType>> |
74 | | requires(IsDecimalNumber<ToCppT> && |
75 | | (IsCppTypeInt<FromCppT> || std::is_same_v<FromCppT, UInt8>)) |
76 | | static inline bool from_int(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
77 | 7 | UInt32 to_scale, CastParameters& params) { |
78 | 7 | MaxNativeType scale_multiplier = |
79 | 7 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); |
80 | 7 | typename ToCppT::NativeType max_result = |
81 | 7 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
82 | 7 | typename ToCppT::NativeType min_result = -max_result; |
83 | | |
84 | 7 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); |
85 | 7 | constexpr UInt32 from_scale = 0; |
86 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
87 | | |
88 | 7 | auto from_max_int_digit_count = from_precision - from_scale; |
89 | 7 | auto to_max_int_digit_count = to_precision - to_scale; |
90 | 7 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); |
91 | 7 | bool multiply_may_overflow = false; |
92 | 7 | if (to_scale > from_scale) { |
93 | 7 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
94 | 7 | } |
95 | 7 | return std::visit( |
96 | 7 | [&](auto multiply_may_overflow, auto narrow_integral) { |
97 | 7 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( |
98 | 7 | from, to, to_precision, to_scale, scale_multiplier, min_result, |
99 | 7 | max_result, params); |
100 | 7 | }, _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Line | Count | Source | 96 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 97 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 98 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 99 | 2 | max_result, params); | 100 | 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 | 96 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 97 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 98 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 99 | 1 | max_result, params); | 100 | 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 | 96 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 97 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 98 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 99 | 1 | max_result, params); | 100 | 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 | 96 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 97 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 98 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 99 | 1 | max_result, params); | 100 | 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 | 96 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 97 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 98 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 99 | 1 | max_result, params); | 100 | 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 | 96 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 97 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 98 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 99 | 1 | max_result, params); | 100 | 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_ |
101 | 7 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
102 | 7 | } _ZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 77 | 2 | UInt32 to_scale, CastParameters& params) { | 78 | 2 | MaxNativeType scale_multiplier = | 79 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 80 | 2 | typename ToCppT::NativeType max_result = | 81 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 82 | 2 | typename ToCppT::NativeType min_result = -max_result; | 83 | | | 84 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 85 | 2 | constexpr UInt32 from_scale = 0; | 86 | 2 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 87 | | | 88 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 89 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 90 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 91 | 2 | bool multiply_may_overflow = false; | 92 | 2 | if (to_scale > from_scale) { | 93 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 94 | 2 | } | 95 | 2 | return std::visit( | 96 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 97 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 98 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 99 | 2 | max_result, params); | 100 | 2 | }, | 101 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 102 | 2 | } |
_ZN5doris13CastToDecimal8from_intIaNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 77 | 1 | UInt32 to_scale, CastParameters& params) { | 78 | 1 | MaxNativeType scale_multiplier = | 79 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 80 | 1 | typename ToCppT::NativeType max_result = | 81 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 82 | 1 | typename ToCppT::NativeType min_result = -max_result; | 83 | | | 84 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 85 | 1 | constexpr UInt32 from_scale = 0; | 86 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 87 | | | 88 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 89 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 90 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 91 | 1 | bool multiply_may_overflow = false; | 92 | 1 | if (to_scale > from_scale) { | 93 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 94 | 1 | } | 95 | 1 | return std::visit( | 96 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 97 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 98 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 99 | 1 | max_result, params); | 100 | 1 | }, | 101 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 102 | 1 | } |
_ZN5doris13CastToDecimal8from_intIsNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 77 | 1 | UInt32 to_scale, CastParameters& params) { | 78 | 1 | MaxNativeType scale_multiplier = | 79 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 80 | 1 | typename ToCppT::NativeType max_result = | 81 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 82 | 1 | typename ToCppT::NativeType min_result = -max_result; | 83 | | | 84 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 85 | 1 | constexpr UInt32 from_scale = 0; | 86 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 87 | | | 88 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 89 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 90 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 91 | 1 | bool multiply_may_overflow = false; | 92 | 1 | if (to_scale > from_scale) { | 93 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 94 | 1 | } | 95 | 1 | return std::visit( | 96 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 97 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 98 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 99 | 1 | max_result, params); | 100 | 1 | }, | 101 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 102 | 1 | } |
_ZN5doris13CastToDecimal8from_intIiNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 77 | 1 | UInt32 to_scale, CastParameters& params) { | 78 | 1 | MaxNativeType scale_multiplier = | 79 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 80 | 1 | typename ToCppT::NativeType max_result = | 81 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 82 | 1 | typename ToCppT::NativeType min_result = -max_result; | 83 | | | 84 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 85 | 1 | constexpr UInt32 from_scale = 0; | 86 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 87 | | | 88 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 89 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 90 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 91 | 1 | bool multiply_may_overflow = false; | 92 | 1 | if (to_scale > from_scale) { | 93 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 94 | 1 | } | 95 | 1 | return std::visit( | 96 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 97 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 98 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 99 | 1 | max_result, params); | 100 | 1 | }, | 101 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 102 | 1 | } |
_ZN5doris13CastToDecimal8from_intIlNS_7DecimalIiEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 77 | 1 | UInt32 to_scale, CastParameters& params) { | 78 | 1 | MaxNativeType scale_multiplier = | 79 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 80 | 1 | typename ToCppT::NativeType max_result = | 81 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 82 | 1 | typename ToCppT::NativeType min_result = -max_result; | 83 | | | 84 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 85 | 1 | constexpr UInt32 from_scale = 0; | 86 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 87 | | | 88 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 89 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 90 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 91 | 1 | bool multiply_may_overflow = false; | 92 | 1 | if (to_scale > from_scale) { | 93 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 94 | 1 | } | 95 | 1 | return std::visit( | 96 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 97 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 98 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 99 | 1 | max_result, params); | 100 | 1 | }, | 101 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 102 | 1 | } |
_ZN5doris13CastToDecimal8from_intInNS_7DecimalIiEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 77 | 1 | UInt32 to_scale, CastParameters& params) { | 78 | 1 | MaxNativeType scale_multiplier = | 79 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 80 | 1 | typename ToCppT::NativeType max_result = | 81 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 82 | 1 | typename ToCppT::NativeType min_result = -max_result; | 83 | | | 84 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 85 | 1 | constexpr UInt32 from_scale = 0; | 86 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 87 | | | 88 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 89 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 90 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 91 | 1 | bool multiply_may_overflow = false; | 92 | 1 | if (to_scale > from_scale) { | 93 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 94 | 1 | } | 95 | 1 | return std::visit( | 96 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 97 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 98 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 99 | 1 | max_result, params); | 100 | 1 | }, | 101 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 102 | 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 |
103 | | |
104 | | // cast bool to decimal |
105 | | template <typename FromCppT, typename ToCppT, |
106 | | typename MaxNativeType = |
107 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
108 | | FromCppT, typename ToCppT::NativeType>> |
109 | | requires(IsDecimalNumber<ToCppT> && std::is_same_v<FromCppT, UInt8>) |
110 | | static inline bool from_bool(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
111 | 2 | UInt32 to_scale, CastParameters& params) { |
112 | 2 | return from_int<FromCppT, ToCppT, MaxNativeType>(from, to, to_precision, to_scale, params); |
113 | 2 | } _ZN5doris13CastToDecimal9from_boolIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Esr3stdE9is_same_vIT_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 111 | 2 | UInt32 to_scale, CastParameters& params) { | 112 | 2 | return from_int<FromCppT, ToCppT, MaxNativeType>(from, to, to_precision, to_scale, params); | 113 | 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 |
114 | | |
115 | | template <typename FromCppT, typename ToCppT> |
116 | | requires(IsDecimalNumber<ToCppT> && IsCppTypeFloat<FromCppT>) |
117 | | static inline bool from_float(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
118 | 2 | UInt32 to_scale, CastParameters& params) { |
119 | 2 | typename ToCppT::NativeType scale_multiplier = |
120 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); |
121 | 2 | typename ToCppT::NativeType max_result = |
122 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
123 | 2 | typename ToCppT::NativeType min_result = -max_result; |
124 | | |
125 | 2 | return _from_float<FromCppT, ToCppT>(from, to, to_precision, to_scale, scale_multiplier, |
126 | 2 | min_result, max_result, params); |
127 | 2 | } _ZN5doris13CastToDecimal10from_floatIdNS_7DecimalIiEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 118 | 1 | UInt32 to_scale, CastParameters& params) { | 119 | 1 | typename ToCppT::NativeType scale_multiplier = | 120 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 121 | 1 | typename ToCppT::NativeType max_result = | 122 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 123 | 1 | typename ToCppT::NativeType min_result = -max_result; | 124 | | | 125 | 1 | return _from_float<FromCppT, ToCppT>(from, to, to_precision, to_scale, scale_multiplier, | 126 | 1 | min_result, max_result, params); | 127 | 1 | } |
_ZN5doris13CastToDecimal10from_floatIfNS_7DecimalIiEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 118 | 1 | UInt32 to_scale, CastParameters& params) { | 119 | 1 | typename ToCppT::NativeType scale_multiplier = | 120 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 121 | 1 | typename ToCppT::NativeType max_result = | 122 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 123 | 1 | typename ToCppT::NativeType min_result = -max_result; | 124 | | | 125 | 1 | return _from_float<FromCppT, ToCppT>(from, to, to_precision, to_scale, scale_multiplier, | 126 | 1 | min_result, max_result, params); | 127 | 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 |
128 | | |
129 | | template <typename FromCppT, typename ToCppT> |
130 | | requires(IsDecimalNumber<ToCppT> && IsCppTypeFloat<FromCppT> && !IsDecimal128V2<ToCppT>) |
131 | | static inline bool _from_float(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
132 | | UInt32 to_scale, |
133 | | const typename ToCppT::NativeType& scale_multiplier, |
134 | | const typename ToCppT::NativeType& min_result, |
135 | | const typename ToCppT::NativeType& max_result, |
136 | 3.35k | CastParameters& params) { |
137 | 3.35k | if (!std::isfinite(from)) { |
138 | 196 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, |
139 | 196 | "Decimal convert overflow. Cannot convert infinity or NaN " |
140 | 196 | "to decimal"); |
141 | 196 | return false; |
142 | 196 | } |
143 | | // For decimal256, we need to use long double to avoid overflow when |
144 | | // static casting the multiplier to floating type, and also to be as precise as possible; |
145 | | // For other decimal types, we use double to be as precise as possible. |
146 | 3.15k | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; |
147 | 3.15k | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); |
148 | 3.15k | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { |
149 | 92 | if (params.is_strict) { |
150 | 46 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, |
151 | 46 | to_scale); |
152 | 46 | } |
153 | 92 | return false; |
154 | 92 | } |
155 | 3.06k | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( |
156 | 3.06k | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); |
157 | 3.06k | return true; |
158 | 3.15k | } _ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIiEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 136 | 441 | CastParameters& params) { | 137 | 441 | if (!std::isfinite(from)) { | 138 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 139 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 140 | 24 | "to decimal"); | 141 | 24 | return false; | 142 | 24 | } | 143 | | // For decimal256, we need to use long double to avoid overflow when | 144 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 145 | | // For other decimal types, we use double to be as precise as possible. | 146 | 417 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 147 | 417 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 148 | 417 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 149 | 12 | if (params.is_strict) { | 150 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 151 | 6 | to_scale); | 152 | 6 | } | 153 | 12 | return false; | 154 | 12 | } | 155 | 405 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 156 | 405 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 157 | 405 | return true; | 158 | 417 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIiEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 136 | 429 | CastParameters& params) { | 137 | 429 | if (!std::isfinite(from)) { | 138 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 139 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 140 | 24 | "to decimal"); | 141 | 24 | return false; | 142 | 24 | } | 143 | | // For decimal256, we need to use long double to avoid overflow when | 144 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 145 | | // For other decimal types, we use double to be as precise as possible. | 146 | 405 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 147 | 405 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 148 | 405 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 149 | 12 | if (params.is_strict) { | 150 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 151 | 6 | to_scale); | 152 | 6 | } | 153 | 12 | return false; | 154 | 12 | } | 155 | 393 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 156 | 393 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 157 | 393 | return true; | 158 | 405 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIlEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 136 | 428 | CastParameters& params) { | 137 | 428 | if (!std::isfinite(from)) { | 138 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 139 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 140 | 24 | "to decimal"); | 141 | 24 | return false; | 142 | 24 | } | 143 | | // For decimal256, we need to use long double to avoid overflow when | 144 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 145 | | // For other decimal types, we use double to be as precise as possible. | 146 | 404 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 147 | 404 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 148 | 404 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 149 | 12 | if (params.is_strict) { | 150 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 151 | 6 | to_scale); | 152 | 6 | } | 153 | 12 | return false; | 154 | 12 | } | 155 | 392 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 156 | 392 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 157 | 392 | return true; | 158 | 404 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIlEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 136 | 380 | CastParameters& params) { | 137 | 380 | if (!std::isfinite(from)) { | 138 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 139 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 140 | 24 | "to decimal"); | 141 | 24 | return false; | 142 | 24 | } | 143 | | // For decimal256, we need to use long double to avoid overflow when | 144 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 145 | | // For other decimal types, we use double to be as precise as possible. | 146 | 356 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 147 | 356 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 148 | 356 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 149 | 12 | if (params.is_strict) { | 150 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 151 | 6 | to_scale); | 152 | 6 | } | 153 | 12 | return false; | 154 | 12 | } | 155 | 344 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 156 | 344 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 157 | 344 | return true; | 158 | 356 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_12Decimal128V3EQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS3_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE Line | Count | Source | 136 | 372 | CastParameters& params) { | 137 | 372 | if (!std::isfinite(from)) { | 138 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 139 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 140 | 24 | "to decimal"); | 141 | 24 | return false; | 142 | 24 | } | 143 | | // For decimal256, we need to use long double to avoid overflow when | 144 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 145 | | // For other decimal types, we use double to be as precise as possible. | 146 | 348 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 147 | 348 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 148 | 348 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 149 | 12 | if (params.is_strict) { | 150 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 151 | 6 | to_scale); | 152 | 6 | } | 153 | 12 | return false; | 154 | 12 | } | 155 | 336 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 156 | 336 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 157 | 336 | return true; | 158 | 348 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_12Decimal128V3EQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS3_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE Line | Count | Source | 136 | 444 | CastParameters& params) { | 137 | 444 | if (!std::isfinite(from)) { | 138 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 139 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 140 | 24 | "to decimal"); | 141 | 24 | return false; | 142 | 24 | } | 143 | | // For decimal256, we need to use long double to avoid overflow when | 144 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 145 | | // For other decimal types, we use double to be as precise as possible. | 146 | 420 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 147 | 420 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 148 | 420 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 149 | 12 | if (params.is_strict) { | 150 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 151 | 6 | to_scale); | 152 | 6 | } | 153 | 12 | return false; | 154 | 12 | } | 155 | 408 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 156 | 408 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 157 | 408 | return true; | 158 | 420 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIN4wide7integerILm256EiEEEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS7_EEEbRKS8_RS7_jjRKNS7_10NativeTypeESE_SE_RNS_14CastParametersE Line | Count | Source | 136 | 436 | CastParameters& params) { | 137 | 436 | if (!std::isfinite(from)) { | 138 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 139 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 140 | 24 | "to decimal"); | 141 | 24 | return false; | 142 | 24 | } | 143 | | // For decimal256, we need to use long double to avoid overflow when | 144 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 145 | | // For other decimal types, we use double to be as precise as possible. | 146 | 412 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 147 | 412 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 148 | 412 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 149 | 12 | if (params.is_strict) { | 150 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 151 | 6 | to_scale); | 152 | 6 | } | 153 | 12 | return false; | 154 | 12 | } | 155 | 400 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 156 | 400 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 157 | 400 | return true; | 158 | 412 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIN4wide7integerILm256EiEEEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS7_EEEbRKS8_RS7_jjRKNS7_10NativeTypeESE_SE_RNS_14CastParametersE Line | Count | Source | 136 | 424 | CastParameters& params) { | 137 | 424 | if (!std::isfinite(from)) { | 138 | 28 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 139 | 28 | "Decimal convert overflow. Cannot convert infinity or NaN " | 140 | 28 | "to decimal"); | 141 | 28 | return false; | 142 | 28 | } | 143 | | // For decimal256, we need to use long double to avoid overflow when | 144 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 145 | | // For other decimal types, we use double to be as precise as possible. | 146 | 396 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 147 | 396 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 148 | 396 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 149 | 8 | if (params.is_strict) { | 150 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 151 | 4 | to_scale); | 152 | 4 | } | 153 | 8 | return false; | 154 | 8 | } | 155 | 388 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 156 | 388 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 157 | 388 | return true; | 158 | 396 | } |
|
159 | | template <typename FromCppT, typename ToCppT> |
160 | | requires(IsDecimal128V2<ToCppT> && IsCppTypeFloat<FromCppT>) |
161 | | static inline bool _from_float(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
162 | | UInt32 to_scale, |
163 | | const typename ToCppT::NativeType& scale_multiplier, |
164 | | const typename ToCppT::NativeType& min_result, |
165 | | const typename ToCppT::NativeType& max_result, |
166 | 0 | CastParameters& params) { |
167 | 0 | if (!std::isfinite(from)) { |
168 | 0 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, |
169 | 0 | "Decimal convert overflow. Cannot convert infinity or NaN " |
170 | 0 | "to decimal"); |
171 | 0 | return false; |
172 | 0 | } |
173 | | // For decimal256, we need to use long double to avoid overflow when |
174 | | // static casting the multiplier to floating type, and also to be as precise as possible; |
175 | | // For other decimal types, we use double to be as precise as possible. |
176 | 0 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; |
177 | 0 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); |
178 | 0 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { |
179 | 0 | if (params.is_strict) { |
180 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, |
181 | 0 | to_scale); |
182 | 0 | } |
183 | 0 | return false; |
184 | 0 | } |
185 | 0 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(static_cast<double>( |
186 | 0 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5)))); |
187 | 0 | return true; |
188 | 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 |
189 | | |
190 | | template <typename FromCppT, typename ToCppT, |
191 | | typename MaxFieldType = std::conditional_t< |
192 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
193 | | (std::is_same_v<ToCppT, Decimal128V3> || |
194 | | std::is_same_v<FromCppT, Decimal128V3>), |
195 | | Decimal128V3, |
196 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
197 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
198 | | static inline bool from_decimalv2(const FromCppT& from, const UInt32 from_precision, |
199 | | const UInt32 from_scale, UInt32 from_original_precision, |
200 | | UInt32 from_original_scale, ToCppT& to, UInt32 to_precision, |
201 | | UInt32 to_scale, CastParameters& params) { |
202 | | using MaxNativeType = typename MaxFieldType::NativeType; |
203 | | |
204 | | auto from_max_int_digit_count = from_original_precision - from_original_scale; |
205 | | auto to_max_int_digit_count = to_precision - to_scale; |
206 | | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || |
207 | | (to_max_int_digit_count == from_max_int_digit_count && |
208 | | to_scale < from_original_scale); |
209 | | |
210 | | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
211 | | bool multiply_may_overflow = false; |
212 | | if (to_scale > from_scale) { |
213 | | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
214 | | } |
215 | | |
216 | | typename ToCppT::NativeType max_result = |
217 | | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
218 | | typename ToCppT::NativeType min_result = -max_result; |
219 | | |
220 | | return std::visit( |
221 | | [&](auto multiply_may_overflow, auto narrow_integral) { |
222 | | if (from_scale < to_scale) { |
223 | | MaxNativeType multiplier = |
224 | | DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier( |
225 | | to_scale - from_scale); |
226 | | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, |
227 | | narrow_integral>( |
228 | | from, from_precision, from_scale, to, to_precision, to_scale, |
229 | | multiplier, min_result, max_result, params); |
230 | | } else if (from_scale == to_scale) { |
231 | | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, |
232 | | narrow_integral>( |
233 | | from, from_precision, from_scale, to, to_precision, to_scale, |
234 | | min_result, max_result, params); |
235 | | } else { |
236 | | MaxNativeType multiplier = |
237 | | DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier( |
238 | | from_scale - to_scale); |
239 | | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, |
240 | | narrow_integral>( |
241 | | from, from_precision, from_scale, to, to_precision, to_scale, |
242 | | multiplier, min_result, max_result, params); |
243 | | } |
244 | | return true; |
245 | | }, |
246 | | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
247 | | } |
248 | | |
249 | | template <typename FromCppT, typename ToCppT, |
250 | | typename MaxFieldType = std::conditional_t< |
251 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
252 | | (std::is_same_v<ToCppT, Decimal128V3> || |
253 | | std::is_same_v<FromCppT, Decimal128V3>), |
254 | | Decimal128V3, |
255 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
256 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
257 | | static inline bool from_decimalv3(const FromCppT& from, const UInt32 from_precision, |
258 | | const UInt32 from_scale, ToCppT& to, UInt32 to_precision, |
259 | 5 | UInt32 to_scale, CastParameters& params) { |
260 | 5 | using MaxNativeType = typename MaxFieldType::NativeType; |
261 | | |
262 | 5 | auto from_max_int_digit_count = from_precision - from_scale; |
263 | 5 | auto to_max_int_digit_count = to_precision - to_scale; |
264 | 5 | bool narrow_integral = |
265 | 5 | (to_max_int_digit_count < from_max_int_digit_count) || |
266 | 5 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
267 | | |
268 | 5 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
269 | 5 | bool multiply_may_overflow = false; |
270 | 5 | if (to_scale > from_scale) { |
271 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
272 | 0 | } |
273 | | |
274 | 5 | typename ToCppT::NativeType max_result = |
275 | 5 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
276 | 5 | typename ToCppT::NativeType min_result = -max_result; |
277 | | |
278 | 5 | MaxNativeType multiplier {}; |
279 | 5 | if (from_scale < to_scale) { |
280 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
281 | 0 | from_scale); |
282 | 5 | } else if (from_scale > to_scale) { |
283 | 3 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
284 | 3 | to_scale); |
285 | 3 | } |
286 | | |
287 | 5 | return std::visit( |
288 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { |
289 | 5 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( |
290 | 5 | from, from_precision, from_scale, to, to_precision, to_scale, |
291 | 5 | min_result, max_result, multiplier, params); |
292 | 5 | }, _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Line | Count | Source | 288 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 289 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 290 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 291 | 1 | min_result, max_result, multiplier, params); | 292 | 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 | 288 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 289 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 290 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 291 | 1 | min_result, max_result, multiplier, params); | 292 | 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 | 288 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 289 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 290 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 291 | 1 | min_result, max_result, multiplier, params); | 292 | 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 | 288 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 289 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 290 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 291 | 1 | min_result, max_result, multiplier, params); | 292 | 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 | 288 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 289 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 290 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 291 | 1 | min_result, max_result, multiplier, params); | 292 | 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_ |
293 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
294 | 5 | } _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersE Line | Count | Source | 259 | 1 | UInt32 to_scale, CastParameters& params) { | 260 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 261 | | | 262 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 263 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 264 | 1 | bool narrow_integral = | 265 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 266 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 267 | | | 268 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 269 | 1 | bool multiply_may_overflow = false; | 270 | 1 | if (to_scale > from_scale) { | 271 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 272 | 0 | } | 273 | | | 274 | 1 | typename ToCppT::NativeType max_result = | 275 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 276 | 1 | typename ToCppT::NativeType min_result = -max_result; | 277 | | | 278 | 1 | MaxNativeType multiplier {}; | 279 | 1 | if (from_scale < to_scale) { | 280 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 281 | 0 | from_scale); | 282 | 1 | } else if (from_scale > to_scale) { | 283 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 284 | 0 | to_scale); | 285 | 0 | } | 286 | | | 287 | 1 | return std::visit( | 288 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 289 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 290 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 291 | 1 | min_result, max_result, multiplier, params); | 292 | 1 | }, | 293 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 294 | 1 | } |
_ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 259 | 1 | UInt32 to_scale, CastParameters& params) { | 260 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 261 | | | 262 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 263 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 264 | 1 | bool narrow_integral = | 265 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 266 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 267 | | | 268 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 269 | 1 | bool multiply_may_overflow = false; | 270 | 1 | if (to_scale > from_scale) { | 271 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 272 | 0 | } | 273 | | | 274 | 1 | typename ToCppT::NativeType max_result = | 275 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 276 | 1 | typename ToCppT::NativeType min_result = -max_result; | 277 | | | 278 | 1 | MaxNativeType multiplier {}; | 279 | 1 | if (from_scale < to_scale) { | 280 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 281 | 0 | from_scale); | 282 | 1 | } else if (from_scale > to_scale) { | 283 | 1 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 284 | 1 | to_scale); | 285 | 1 | } | 286 | | | 287 | 1 | return std::visit( | 288 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 289 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 290 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 291 | 1 | min_result, max_result, multiplier, params); | 292 | 1 | }, | 293 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 294 | 1 | } |
_ZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 259 | 1 | UInt32 to_scale, CastParameters& params) { | 260 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 261 | | | 262 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 263 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 264 | 1 | bool narrow_integral = | 265 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 266 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 267 | | | 268 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 269 | 1 | bool multiply_may_overflow = false; | 270 | 1 | if (to_scale > from_scale) { | 271 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 272 | 0 | } | 273 | | | 274 | 1 | typename ToCppT::NativeType max_result = | 275 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 276 | 1 | typename ToCppT::NativeType min_result = -max_result; | 277 | | | 278 | 1 | MaxNativeType multiplier {}; | 279 | 1 | if (from_scale < to_scale) { | 280 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 281 | 0 | from_scale); | 282 | 1 | } else if (from_scale > to_scale) { | 283 | 1 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 284 | 1 | to_scale); | 285 | 1 | } | 286 | | | 287 | 1 | return std::visit( | 288 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 289 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 290 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 291 | 1 | min_result, max_result, multiplier, params); | 292 | 1 | }, | 293 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 294 | 1 | } |
_ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Line | Count | Source | 259 | 1 | UInt32 to_scale, CastParameters& params) { | 260 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 261 | | | 262 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 263 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 264 | 1 | bool narrow_integral = | 265 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 266 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 267 | | | 268 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 269 | 1 | bool multiply_may_overflow = false; | 270 | 1 | if (to_scale > from_scale) { | 271 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 272 | 0 | } | 273 | | | 274 | 1 | typename ToCppT::NativeType max_result = | 275 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 276 | 1 | typename ToCppT::NativeType min_result = -max_result; | 277 | | | 278 | 1 | MaxNativeType multiplier {}; | 279 | 1 | if (from_scale < to_scale) { | 280 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 281 | 0 | from_scale); | 282 | 1 | } else if (from_scale > to_scale) { | 283 | 1 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 284 | 1 | to_scale); | 285 | 1 | } | 286 | | | 287 | 1 | return std::visit( | 288 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 289 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 290 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 291 | 1 | min_result, max_result, multiplier, params); | 292 | 1 | }, | 293 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 294 | 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 | 259 | 1 | UInt32 to_scale, CastParameters& params) { | 260 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 261 | | | 262 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 263 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 264 | 1 | bool narrow_integral = | 265 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 266 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 267 | | | 268 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 269 | 1 | bool multiply_may_overflow = false; | 270 | 1 | if (to_scale > from_scale) { | 271 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 272 | 0 | } | 273 | | | 274 | 1 | typename ToCppT::NativeType max_result = | 275 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 276 | 1 | typename ToCppT::NativeType min_result = -max_result; | 277 | | | 278 | 1 | MaxNativeType multiplier {}; | 279 | 1 | if (from_scale < to_scale) { | 280 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 281 | 0 | from_scale); | 282 | 1 | } else if (from_scale > to_scale) { | 283 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 284 | 0 | to_scale); | 285 | 0 | } | 286 | | | 287 | 1 | return std::visit( | 288 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 289 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 290 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 291 | 1 | min_result, max_result, multiplier, params); | 292 | 1 | }, | 293 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 294 | 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 |
295 | | |
296 | | template <typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
297 | | typename MaxFieldType = std::conditional_t< |
298 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
299 | | (std::is_same_v<ToCppT, Decimal128V3> || |
300 | | std::is_same_v<FromCppT, Decimal128V3>), |
301 | | Decimal128V3, |
302 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
303 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
304 | | static inline bool _from_decimal(const FromCppT& from, const UInt32 from_precision, |
305 | | const UInt32 from_scale, ToCppT& to, UInt32 to_precision, |
306 | | UInt32 to_scale, const ToCppT::NativeType& min_result, |
307 | | const ToCppT::NativeType& max_result, |
308 | | const typename MaxFieldType::NativeType& scale_multiplier, |
309 | 14.8k | CastParameters& params) { |
310 | 14.8k | using MaxNativeType = typename MaxFieldType::NativeType; |
311 | | |
312 | 14.8k | if (from_scale < to_scale) { |
313 | 4.59k | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, |
314 | 4.59k | narrow_integral>( |
315 | 4.59k | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, |
316 | 4.59k | min_result, max_result, params); |
317 | 10.2k | } else if (from_scale == to_scale) { |
318 | 1.86k | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( |
319 | 1.86k | from, from_precision, from_scale, to, to_precision, to_scale, min_result, |
320 | 1.86k | max_result, params); |
321 | 8.38k | } else { |
322 | 8.38k | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, |
323 | 8.38k | narrow_integral>( |
324 | 8.38k | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, |
325 | 8.38k | min_result, max_result, params); |
326 | 8.38k | } |
327 | 0 | return true; |
328 | 14.8k | } _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEES3_Lb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 134 | CastParameters& params) { | 310 | 134 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 134 | if (from_scale < to_scale) { | 313 | 14 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 14 | narrow_integral>( | 315 | 14 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 14 | min_result, max_result, params); | 317 | 120 | } else if (from_scale == to_scale) { | 318 | 8 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 8 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 8 | max_result, params); | 321 | 112 | } else { | 322 | 112 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 112 | narrow_integral>( | 324 | 112 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 112 | min_result, max_result, params); | 326 | 112 | } | 327 | 0 | return true; | 328 | 134 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEES3_Lb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 108 | CastParameters& params) { | 310 | 108 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 108 | if (from_scale < to_scale) { | 313 | 7 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 7 | narrow_integral>( | 315 | 7 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 7 | min_result, max_result, params); | 317 | 101 | } else if (from_scale == to_scale) { | 318 | 19 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 19 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 19 | max_result, params); | 321 | 82 | } else { | 322 | 82 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 82 | narrow_integral>( | 324 | 82 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 82 | min_result, max_result, params); | 326 | 82 | } | 327 | 0 | return true; | 328 | 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 | 309 | 84 | CastParameters& params) { | 310 | 84 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 84 | if (from_scale < to_scale) { | 313 | 84 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 84 | narrow_integral>( | 315 | 84 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 84 | min_result, max_result, params); | 317 | 84 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 84 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IiEELb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 160 | CastParameters& params) { | 310 | 160 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 160 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 160 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 160 | } else { | 322 | 160 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 160 | narrow_integral>( | 324 | 160 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 160 | min_result, max_result, params); | 326 | 160 | } | 327 | 0 | return true; | 328 | 160 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IiEELb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 459 | CastParameters& params) { | 310 | 459 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 459 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 459 | } else if (from_scale == to_scale) { | 318 | 136 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 136 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 136 | max_result, params); | 321 | 323 | } else { | 322 | 323 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 323 | narrow_integral>( | 324 | 323 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 323 | min_result, max_result, params); | 326 | 323 | } | 327 | 0 | return true; | 328 | 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 | 309 | 126 | CastParameters& params) { | 310 | 126 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 126 | if (from_scale < to_scale) { | 313 | 126 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 126 | narrow_integral>( | 315 | 126 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 126 | min_result, max_result, params); | 317 | 126 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 126 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIiEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 160 | CastParameters& params) { | 310 | 160 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 160 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 160 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 160 | } else { | 322 | 160 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 160 | narrow_integral>( | 324 | 160 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 160 | min_result, max_result, params); | 326 | 160 | } | 327 | 0 | return true; | 328 | 160 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIiEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 479 | CastParameters& params) { | 310 | 479 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 479 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 479 | } else if (from_scale == to_scale) { | 318 | 122 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 122 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 122 | max_result, params); | 321 | 357 | } else { | 322 | 357 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 357 | narrow_integral>( | 324 | 357 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 357 | min_result, max_result, params); | 326 | 357 | } | 327 | 0 | return true; | 328 | 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 | 309 | 126 | CastParameters& params) { | 310 | 126 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 126 | if (from_scale < to_scale) { | 313 | 126 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 126 | narrow_integral>( | 315 | 126 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 126 | min_result, max_result, params); | 317 | 126 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 126 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 160 | CastParameters& params) { | 310 | 160 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 160 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 160 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 160 | } else { | 322 | 160 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 160 | narrow_integral>( | 324 | 160 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 160 | min_result, max_result, params); | 326 | 160 | } | 327 | 0 | return true; | 328 | 160 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 479 | CastParameters& params) { | 310 | 479 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 479 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 479 | } else if (from_scale == to_scale) { | 318 | 122 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 122 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 122 | max_result, params); | 321 | 357 | } else { | 322 | 357 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 357 | narrow_integral>( | 324 | 357 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 357 | min_result, max_result, params); | 326 | 357 | } | 327 | 0 | return true; | 328 | 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 | 309 | 126 | CastParameters& params) { | 310 | 126 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 126 | if (from_scale < to_scale) { | 313 | 126 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 126 | narrow_integral>( | 315 | 126 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 126 | min_result, max_result, params); | 317 | 126 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 126 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IlEELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 378 | CastParameters& params) { | 310 | 378 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 378 | if (from_scale < to_scale) { | 313 | 112 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 112 | narrow_integral>( | 315 | 112 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 112 | min_result, max_result, params); | 317 | 266 | } else if (from_scale == to_scale) { | 318 | 82 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 82 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 82 | max_result, params); | 321 | 184 | } else { | 322 | 184 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 184 | narrow_integral>( | 324 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 184 | min_result, max_result, params); | 326 | 184 | } | 327 | 0 | return true; | 328 | 378 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IlEELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 58 | CastParameters& params) { | 310 | 58 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 58 | if (from_scale < to_scale) { | 313 | 58 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 58 | narrow_integral>( | 315 | 58 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 58 | min_result, max_result, params); | 317 | 58 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 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 | 309 | 72 | CastParameters& params) { | 310 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 72 | if (from_scale < to_scale) { | 313 | 72 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 72 | narrow_integral>( | 315 | 72 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 72 | min_result, max_result, params); | 317 | 72 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 72 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEES3_Lb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 428 | CastParameters& params) { | 310 | 428 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 428 | if (from_scale < to_scale) { | 313 | 46 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 46 | narrow_integral>( | 315 | 46 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 46 | min_result, max_result, params); | 317 | 382 | } else if (from_scale == to_scale) { | 318 | 30 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 30 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 30 | max_result, params); | 321 | 352 | } else { | 322 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 352 | narrow_integral>( | 324 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 352 | min_result, max_result, params); | 326 | 352 | } | 327 | 0 | return true; | 328 | 428 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEES3_Lb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 182 | CastParameters& params) { | 310 | 182 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 182 | if (from_scale < to_scale) { | 313 | 44 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 44 | narrow_integral>( | 315 | 44 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 44 | min_result, max_result, params); | 317 | 138 | } else if (from_scale == to_scale) { | 318 | 42 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 42 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 42 | max_result, params); | 321 | 96 | } else { | 322 | 96 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 96 | narrow_integral>( | 324 | 96 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 96 | min_result, max_result, params); | 326 | 96 | } | 327 | 0 | return true; | 328 | 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 | 309 | 210 | CastParameters& params) { | 310 | 210 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 210 | if (from_scale < to_scale) { | 313 | 210 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 210 | narrow_integral>( | 315 | 210 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 210 | min_result, max_result, params); | 317 | 210 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 210 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIlEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 288 | CastParameters& params) { | 310 | 288 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 288 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 288 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 288 | } else { | 322 | 288 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 288 | narrow_integral>( | 324 | 288 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 288 | min_result, max_result, params); | 326 | 288 | } | 327 | 0 | return true; | 328 | 288 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIlEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 532 | CastParameters& params) { | 310 | 532 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 532 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 532 | } else if (from_scale == to_scale) { | 318 | 182 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 182 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 182 | max_result, params); | 321 | 350 | } else { | 322 | 350 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 350 | narrow_integral>( | 324 | 350 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 350 | min_result, max_result, params); | 326 | 350 | } | 327 | 0 | return true; | 328 | 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 | 309 | 224 | CastParameters& params) { | 310 | 224 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 224 | if (from_scale < to_scale) { | 313 | 224 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 224 | narrow_integral>( | 315 | 224 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 224 | min_result, max_result, params); | 317 | 224 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 224 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 288 | CastParameters& params) { | 310 | 288 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 288 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 288 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 288 | } else { | 322 | 288 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 288 | narrow_integral>( | 324 | 288 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 288 | min_result, max_result, params); | 326 | 288 | } | 327 | 0 | return true; | 328 | 288 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 552 | CastParameters& params) { | 310 | 552 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 552 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 552 | } else if (from_scale == to_scale) { | 318 | 168 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 168 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 168 | max_result, params); | 321 | 384 | } else { | 322 | 384 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 384 | narrow_integral>( | 324 | 384 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 384 | min_result, max_result, params); | 326 | 384 | } | 327 | 0 | return true; | 328 | 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 | 309 | 224 | CastParameters& params) { | 310 | 224 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 224 | if (from_scale < to_scale) { | 313 | 224 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 224 | narrow_integral>( | 315 | 224 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 224 | min_result, max_result, params); | 317 | 224 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 224 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS_12Decimal128V3ELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 378 | CastParameters& params) { | 310 | 378 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 378 | if (from_scale < to_scale) { | 313 | 120 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 120 | narrow_integral>( | 315 | 120 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 120 | min_result, max_result, params); | 317 | 258 | } else if (from_scale == to_scale) { | 318 | 74 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 74 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 74 | max_result, params); | 321 | 184 | } else { | 322 | 184 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 184 | narrow_integral>( | 324 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 184 | min_result, max_result, params); | 326 | 184 | } | 327 | 0 | return true; | 328 | 378 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS_12Decimal128V3ELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 65 | CastParameters& params) { | 310 | 65 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 65 | if (from_scale < to_scale) { | 313 | 65 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 65 | narrow_integral>( | 315 | 65 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 65 | min_result, max_result, params); | 317 | 65 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 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 | 309 | 65 | CastParameters& params) { | 310 | 65 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 65 | if (from_scale < to_scale) { | 313 | 65 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 65 | narrow_integral>( | 315 | 65 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 65 | min_result, max_result, params); | 317 | 65 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 65 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 656 | CastParameters& params) { | 310 | 656 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 656 | if (from_scale < to_scale) { | 313 | 176 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 176 | narrow_integral>( | 315 | 176 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 176 | min_result, max_result, params); | 317 | 480 | } else if (from_scale == to_scale) { | 318 | 128 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 128 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 128 | max_result, params); | 321 | 352 | } else { | 322 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 352 | narrow_integral>( | 324 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 352 | min_result, max_result, params); | 326 | 352 | } | 327 | 0 | return true; | 328 | 656 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 116 | CastParameters& params) { | 310 | 116 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 116 | if (from_scale < to_scale) { | 313 | 116 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 116 | narrow_integral>( | 315 | 116 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 116 | min_result, max_result, params); | 317 | 116 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 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 | 309 | 116 | CastParameters& params) { | 310 | 116 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 116 | if (from_scale < to_scale) { | 313 | 116 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 116 | narrow_integral>( | 315 | 116 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 116 | min_result, max_result, params); | 317 | 116 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 116 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ES2_Lb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 429 | CastParameters& params) { | 310 | 429 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 429 | if (from_scale < to_scale) { | 313 | 46 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 46 | narrow_integral>( | 315 | 46 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 46 | min_result, max_result, params); | 317 | 383 | } else if (from_scale == to_scale) { | 318 | 31 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 31 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 31 | max_result, params); | 321 | 352 | } else { | 322 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 352 | narrow_integral>( | 324 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 352 | min_result, max_result, params); | 326 | 352 | } | 327 | 0 | return true; | 328 | 429 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ES2_Lb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 208 | CastParameters& params) { | 310 | 208 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 208 | if (from_scale < to_scale) { | 313 | 70 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 70 | narrow_integral>( | 315 | 70 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 70 | min_result, max_result, params); | 317 | 138 | } else if (from_scale == to_scale) { | 318 | 42 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 42 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 42 | max_result, params); | 321 | 96 | } else { | 322 | 96 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 96 | narrow_integral>( | 324 | 96 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 96 | min_result, max_result, params); | 326 | 96 | } | 327 | 0 | return true; | 328 | 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 | 309 | 184 | CastParameters& params) { | 310 | 184 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 184 | if (from_scale < to_scale) { | 313 | 184 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 184 | narrow_integral>( | 315 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 184 | min_result, max_result, params); | 317 | 184 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 184 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 288 | CastParameters& params) { | 310 | 288 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 288 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 288 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 288 | } else { | 322 | 288 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 288 | narrow_integral>( | 324 | 288 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 288 | min_result, max_result, params); | 326 | 288 | } | 327 | 0 | return true; | 328 | 288 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 532 | CastParameters& params) { | 310 | 532 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 532 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 532 | } else if (from_scale == to_scale) { | 318 | 182 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 182 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 182 | max_result, params); | 321 | 350 | } else { | 322 | 350 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 350 | narrow_integral>( | 324 | 350 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 350 | min_result, max_result, params); | 326 | 350 | } | 327 | 0 | return true; | 328 | 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 | 309 | 224 | CastParameters& params) { | 310 | 224 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 224 | if (from_scale < to_scale) { | 313 | 224 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 224 | narrow_integral>( | 315 | 224 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 224 | min_result, max_result, params); | 317 | 224 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 224 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 378 | CastParameters& params) { | 310 | 378 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 378 | if (from_scale < to_scale) { | 313 | 120 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 120 | narrow_integral>( | 315 | 120 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 120 | min_result, max_result, params); | 317 | 258 | } else if (from_scale == to_scale) { | 318 | 74 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 74 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 74 | max_result, params); | 321 | 184 | } else { | 322 | 184 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 184 | narrow_integral>( | 324 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 184 | min_result, max_result, params); | 326 | 184 | } | 327 | 0 | return true; | 328 | 378 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 65 | CastParameters& params) { | 310 | 65 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 65 | if (from_scale < to_scale) { | 313 | 65 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 65 | narrow_integral>( | 315 | 65 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 65 | min_result, max_result, params); | 317 | 65 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 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 | 309 | 65 | CastParameters& params) { | 310 | 65 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 65 | if (from_scale < to_scale) { | 313 | 65 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 65 | narrow_integral>( | 315 | 65 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 65 | min_result, max_result, params); | 317 | 65 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 65 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 656 | CastParameters& params) { | 310 | 656 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 656 | if (from_scale < to_scale) { | 313 | 184 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 184 | narrow_integral>( | 315 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 184 | min_result, max_result, params); | 317 | 472 | } else if (from_scale == to_scale) { | 318 | 120 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 120 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 120 | max_result, params); | 321 | 352 | } else { | 322 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 352 | narrow_integral>( | 324 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 352 | min_result, max_result, params); | 326 | 352 | } | 327 | 0 | return true; | 328 | 656 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 116 | CastParameters& params) { | 310 | 116 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 116 | if (from_scale < to_scale) { | 313 | 116 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 116 | narrow_integral>( | 315 | 116 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 116 | min_result, max_result, params); | 317 | 116 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 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 | 309 | 116 | CastParameters& params) { | 310 | 116 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 116 | if (from_scale < to_scale) { | 313 | 116 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 116 | narrow_integral>( | 315 | 116 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 116 | min_result, max_result, params); | 317 | 116 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 116 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 656 | CastParameters& params) { | 310 | 656 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 656 | if (from_scale < to_scale) { | 313 | 176 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 176 | narrow_integral>( | 315 | 176 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 176 | min_result, max_result, params); | 317 | 480 | } else if (from_scale == to_scale) { | 318 | 128 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 128 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 128 | max_result, params); | 321 | 352 | } else { | 322 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 352 | narrow_integral>( | 324 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 352 | min_result, max_result, params); | 326 | 352 | } | 327 | 0 | return true; | 328 | 656 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 109 | CastParameters& params) { | 310 | 109 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 109 | if (from_scale < to_scale) { | 313 | 109 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 109 | narrow_integral>( | 315 | 109 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 109 | min_result, max_result, params); | 317 | 109 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 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 | 309 | 123 | CastParameters& params) { | 310 | 123 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 123 | if (from_scale < to_scale) { | 313 | 123 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 123 | narrow_integral>( | 315 | 123 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 123 | min_result, max_result, params); | 317 | 123 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 123 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 428 | CastParameters& params) { | 310 | 428 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 428 | if (from_scale < to_scale) { | 313 | 46 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 46 | narrow_integral>( | 315 | 46 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 46 | min_result, max_result, params); | 317 | 382 | } else if (from_scale == to_scale) { | 318 | 30 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 30 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 30 | max_result, params); | 321 | 352 | } else { | 322 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 352 | narrow_integral>( | 324 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 352 | min_result, max_result, params); | 326 | 352 | } | 327 | 0 | return true; | 328 | 428 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 182 | CastParameters& params) { | 310 | 182 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 182 | if (from_scale < to_scale) { | 313 | 44 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 44 | narrow_integral>( | 315 | 44 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 44 | min_result, max_result, params); | 317 | 138 | } else if (from_scale == to_scale) { | 318 | 42 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 42 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 42 | max_result, params); | 321 | 96 | } else { | 322 | 96 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 96 | narrow_integral>( | 324 | 96 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 96 | min_result, max_result, params); | 326 | 96 | } | 327 | 0 | return true; | 328 | 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 | 309 | 210 | CastParameters& params) { | 310 | 210 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 210 | if (from_scale < to_scale) { | 313 | 210 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 210 | narrow_integral>( | 315 | 210 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 210 | min_result, max_result, params); | 317 | 210 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 210 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 36 | CastParameters& params) { | 310 | 36 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 36 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 36 | } else if (from_scale == to_scale) { | 318 | 4 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 4 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 4 | max_result, params); | 321 | 32 | } else { | 322 | 32 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 32 | narrow_integral>( | 324 | 32 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 32 | min_result, max_result, params); | 326 | 32 | } | 327 | 0 | return true; | 328 | 36 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 470 | CastParameters& params) { | 310 | 470 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 470 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 470 | } else if (from_scale == to_scale) { | 318 | 35 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 35 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 35 | max_result, params); | 321 | 435 | } else { | 322 | 435 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 435 | narrow_integral>( | 324 | 435 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 435 | min_result, max_result, params); | 326 | 435 | } | 327 | 0 | return true; | 328 | 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 | 309 | 131 | CastParameters& params) { | 310 | 131 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 131 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 131 | } else if (from_scale == to_scale) { | 318 | 7 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 7 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 7 | max_result, params); | 321 | 124 | } else { | 322 | 124 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 124 | narrow_integral>( | 324 | 124 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 124 | min_result, max_result, params); | 326 | 124 | } | 327 | 0 | return true; | 328 | 131 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 414 | CastParameters& params) { | 310 | 414 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 414 | if (from_scale < to_scale) { | 313 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 0 | narrow_integral>( | 315 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 0 | min_result, max_result, params); | 317 | 414 | } else if (from_scale == to_scale) { | 318 | 60 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 60 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 60 | max_result, params); | 321 | 354 | } else { | 322 | 354 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 354 | narrow_integral>( | 324 | 354 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 354 | min_result, max_result, params); | 326 | 354 | } | 327 | 0 | return true; | 328 | 414 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 15 | CastParameters& params) { | 310 | 15 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 15 | if (from_scale < to_scale) { | 313 | 15 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 15 | narrow_integral>( | 315 | 15 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 15 | min_result, max_result, params); | 317 | 15 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 15 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 130 | CastParameters& params) { | 310 | 130 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 130 | if (from_scale < to_scale) { | 313 | 130 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 130 | narrow_integral>( | 315 | 130 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 130 | min_result, max_result, params); | 317 | 130 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 130 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 375 | CastParameters& params) { | 310 | 375 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 375 | if (from_scale < to_scale) { | 313 | 11 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 11 | narrow_integral>( | 315 | 11 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 11 | min_result, max_result, params); | 317 | 364 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 364 | } else { | 322 | 364 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 364 | narrow_integral>( | 324 | 364 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 364 | min_result, max_result, params); | 326 | 364 | } | 327 | 0 | return true; | 328 | 375 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 145 | CastParameters& params) { | 310 | 145 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 145 | if (from_scale < to_scale) { | 313 | 95 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 95 | narrow_integral>( | 315 | 95 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 95 | min_result, max_result, params); | 317 | 95 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 50 | } else { | 322 | 50 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 50 | narrow_integral>( | 324 | 50 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 50 | min_result, max_result, params); | 326 | 50 | } | 327 | 0 | return true; | 328 | 145 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 11 | CastParameters& params) { | 310 | 11 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 11 | if (from_scale < to_scale) { | 313 | 11 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 11 | narrow_integral>( | 315 | 11 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 11 | min_result, max_result, params); | 317 | 11 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 11 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 95 | CastParameters& params) { | 310 | 95 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 95 | if (from_scale < to_scale) { | 313 | 95 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 95 | narrow_integral>( | 315 | 95 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 95 | min_result, max_result, params); | 317 | 95 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 95 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 423 | CastParameters& params) { | 310 | 423 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 423 | if (from_scale < to_scale) { | 313 | 11 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 11 | narrow_integral>( | 315 | 11 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 11 | min_result, max_result, params); | 317 | 412 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 412 | } else { | 322 | 412 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 412 | narrow_integral>( | 324 | 412 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 412 | min_result, max_result, params); | 326 | 412 | } | 327 | 0 | return true; | 328 | 423 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 95 | CastParameters& params) { | 310 | 95 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 95 | if (from_scale < to_scale) { | 313 | 95 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 95 | narrow_integral>( | 315 | 95 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 95 | min_result, max_result, params); | 317 | 95 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 95 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 11 | CastParameters& params) { | 310 | 11 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 11 | if (from_scale < to_scale) { | 313 | 11 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 11 | narrow_integral>( | 315 | 11 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 11 | min_result, max_result, params); | 317 | 11 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 11 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 309 | 95 | CastParameters& params) { | 310 | 95 | using MaxNativeType = typename MaxFieldType::NativeType; | 311 | | | 312 | 95 | if (from_scale < to_scale) { | 313 | 95 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 314 | 95 | narrow_integral>( | 315 | 95 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 316 | 95 | min_result, max_result, params); | 317 | 95 | } else if (from_scale == to_scale) { | 318 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 319 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 320 | 0 | max_result, params); | 321 | 0 | } else { | 322 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 323 | 0 | narrow_integral>( | 324 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 325 | 0 | min_result, max_result, params); | 326 | 0 | } | 327 | 0 | return true; | 328 | 95 | } |
|
329 | | |
330 | | template < |
331 | | typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
332 | | typename MaxNativeType = std::conditional_t< |
333 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
334 | | (std::is_same_v<ToCppT, Decimal128V3> || |
335 | | std::is_same_v<FromCppT, Decimal128V3>), |
336 | | Decimal128V3::NativeType, |
337 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), |
338 | | typename FromCppT::NativeType, typename ToCppT::NativeType>>> |
339 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
340 | | static inline bool _from_decimal_smaller_scale( |
341 | | const FromCppT& from, const UInt32 precision_from, const UInt32 scale_from, ToCppT& to, |
342 | | UInt32 precision_to, UInt32 scale_to, const MaxNativeType& scale_multiplier, |
343 | | const typename ToCppT::NativeType& min_result, |
344 | 4.59k | const typename ToCppT::NativeType& max_result, CastParameters& params) { |
345 | 4.59k | MaxNativeType res; |
346 | 4.59k | if constexpr (multiply_may_overflow) { |
347 | 2.65k | if constexpr (IsDecimal128V2<FromCppT>) { |
348 | 357 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, |
349 | 357 | res)) { |
350 | 28 | if (params.is_strict) { |
351 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
352 | 6 | decimal_to_string(from.value(), scale_from), |
353 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), |
354 | 6 | precision_to, scale_to); |
355 | 6 | } |
356 | 28 | return false; |
357 | 329 | } else { |
358 | 329 | if (UNLIKELY(res > max_result || res < -max_result)) { |
359 | 80 | if (params.is_strict) { |
360 | 48 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
361 | 48 | decimal_to_string(from.value(), scale_from), |
362 | 48 | fmt::format("decimal({}, {})", precision_from, scale_from), |
363 | 48 | precision_to, scale_to); |
364 | 48 | } |
365 | 80 | return false; |
366 | 249 | } else { |
367 | 249 | to = ToCppT(res); |
368 | 249 | } |
369 | 329 | } |
370 | 2.29k | } else { |
371 | 2.29k | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, |
372 | 2.29k | res)) { |
373 | 359 | if (params.is_strict) { |
374 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
375 | 30 | decimal_to_string(from.value, scale_from), |
376 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), |
377 | 30 | precision_to, scale_to); |
378 | 30 | } |
379 | 359 | return false; |
380 | 1.93k | } else { |
381 | 1.93k | if (UNLIKELY(res > max_result || res < -max_result)) { |
382 | 889 | if (params.is_strict) { |
383 | 594 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
384 | 594 | decimal_to_string(from.value, scale_from), |
385 | 594 | fmt::format("decimal({}, {})", precision_from, scale_from), |
386 | 594 | precision_to, scale_to); |
387 | 594 | } |
388 | 889 | return false; |
389 | 1.04k | } else { |
390 | 1.04k | to = ToCppT(res); |
391 | 1.04k | } |
392 | 1.93k | } |
393 | 2.29k | } |
394 | 2.65k | } else { |
395 | 1.94k | if constexpr (IsDecimal128V2<FromCppT>) { |
396 | 212 | res = from.value() * scale_multiplier; |
397 | 1.73k | } else { |
398 | 1.73k | res = from.value * scale_multiplier; |
399 | 1.73k | } |
400 | 1.94k | if constexpr (narrow_integral) { |
401 | 884 | if (UNLIKELY(res > max_result || res < -max_result)) { |
402 | 414 | if constexpr (IsDecimal128V2<FromCppT>) { |
403 | 60 | if (params.is_strict) { |
404 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
405 | 30 | decimal_to_string(from.value(), scale_from), |
406 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), |
407 | 30 | precision_to, scale_to); |
408 | 30 | } |
409 | 354 | } else { |
410 | 354 | if (params.is_strict) { |
411 | 177 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
412 | 177 | decimal_to_string(from.value, scale_from), |
413 | 177 | fmt::format("decimal({}, {})", precision_from, scale_from), |
414 | 177 | precision_to, scale_to); |
415 | 177 | } |
416 | 354 | } |
417 | 414 | return false; |
418 | 414 | } |
419 | 884 | } |
420 | 470 | to = ToCppT(res); |
421 | 1.94k | } |
422 | 1.29k | return true; |
423 | 4.59k | } _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEES3_Lb0ELb0EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 344 | 14 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 14 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 14 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 14 | } else { | 398 | 14 | res = from.value * scale_multiplier; | 399 | 14 | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | 14 | to = ToCppT(res); | 421 | 14 | } | 422 | 14 | return true; | 423 | 14 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEES3_Lb0ELb1EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 344 | 7 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 7 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 7 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 7 | } else { | 398 | 7 | res = from.value * scale_multiplier; | 399 | 7 | } | 400 | 7 | if constexpr (narrow_integral) { | 401 | 7 | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | 6 | } else { | 410 | 6 | if (params.is_strict) { | 411 | 3 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | 3 | decimal_to_string(from.value, scale_from), | 413 | 3 | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | 3 | precision_to, scale_to); | 415 | 3 | } | 416 | 6 | } | 417 | 6 | return false; | 418 | 6 | } | 419 | 7 | } | 420 | 1 | to = ToCppT(res); | 421 | 7 | } | 422 | 0 | return true; | 423 | 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 | 344 | 84 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 84 | MaxNativeType res; | 346 | 84 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 84 | } else { | 371 | 84 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 84 | res)) { | 373 | 16 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 16 | return false; | 380 | 68 | } else { | 381 | 68 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 32 | if (params.is_strict) { | 383 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 24 | decimal_to_string(from.value, scale_from), | 385 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 24 | precision_to, scale_to); | 387 | 24 | } | 388 | 32 | return false; | 389 | 36 | } else { | 390 | 36 | to = ToCppT(res); | 391 | 36 | } | 392 | 68 | } | 393 | 84 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 36 | return true; | 423 | 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 | 344 | 126 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 126 | MaxNativeType res; | 346 | 126 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 126 | } else { | 371 | 126 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 126 | res)) { | 373 | 14 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 14 | return false; | 380 | 112 | } else { | 381 | 112 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 58 | if (params.is_strict) { | 383 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 36 | decimal_to_string(from.value, scale_from), | 385 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 36 | precision_to, scale_to); | 387 | 36 | } | 388 | 58 | return false; | 389 | 58 | } else { | 390 | 54 | to = ToCppT(res); | 391 | 54 | } | 392 | 112 | } | 393 | 126 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 54 | return true; | 423 | 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 | 344 | 126 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 126 | MaxNativeType res; | 346 | 126 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 126 | } else { | 371 | 126 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 126 | res)) { | 373 | 12 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 12 | return false; | 380 | 114 | } else { | 381 | 114 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 60 | if (params.is_strict) { | 383 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 36 | decimal_to_string(from.value, scale_from), | 385 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 36 | precision_to, scale_to); | 387 | 36 | } | 388 | 60 | return false; | 389 | 60 | } else { | 390 | 54 | to = ToCppT(res); | 391 | 54 | } | 392 | 114 | } | 393 | 126 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 54 | return true; | 423 | 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 | 344 | 126 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 126 | MaxNativeType res; | 346 | 126 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 126 | } else { | 371 | 126 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 126 | res)) { | 373 | 12 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 12 | return false; | 380 | 114 | } else { | 381 | 114 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 60 | if (params.is_strict) { | 383 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 36 | decimal_to_string(from.value, scale_from), | 385 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 36 | precision_to, scale_to); | 387 | 36 | } | 388 | 60 | return false; | 389 | 60 | } else { | 390 | 54 | to = ToCppT(res); | 391 | 54 | } | 392 | 114 | } | 393 | 126 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 54 | return true; | 423 | 126 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IlEELb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 344 | 112 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 112 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 112 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 112 | } else { | 398 | 112 | res = from.value * scale_multiplier; | 399 | 112 | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | 112 | to = ToCppT(res); | 421 | 112 | } | 422 | 112 | return true; | 423 | 112 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IlEELb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 344 | 58 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 58 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 58 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 58 | } else { | 398 | 58 | res = from.value * scale_multiplier; | 399 | 58 | } | 400 | 58 | if constexpr (narrow_integral) { | 401 | 58 | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | 30 | } else { | 410 | 30 | if (params.is_strict) { | 411 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | 15 | decimal_to_string(from.value, scale_from), | 413 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | 15 | precision_to, scale_to); | 415 | 15 | } | 416 | 30 | } | 417 | 30 | return false; | 418 | 30 | } | 419 | 58 | } | 420 | 28 | to = ToCppT(res); | 421 | 58 | } | 422 | 0 | return true; | 423 | 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 | 344 | 72 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 72 | MaxNativeType res; | 346 | 72 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 72 | } else { | 371 | 72 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 72 | res)) { | 373 | 11 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 11 | return false; | 380 | 61 | } else { | 381 | 61 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 31 | if (params.is_strict) { | 383 | 21 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 21 | decimal_to_string(from.value, scale_from), | 385 | 21 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 21 | precision_to, scale_to); | 387 | 21 | } | 388 | 31 | return false; | 389 | 31 | } else { | 390 | 30 | to = ToCppT(res); | 391 | 30 | } | 392 | 61 | } | 393 | 72 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 30 | return true; | 423 | 72 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEES3_Lb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 344 | 46 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 46 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 46 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 46 | } else { | 398 | 46 | res = from.value * scale_multiplier; | 399 | 46 | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | 46 | to = ToCppT(res); | 421 | 46 | } | 422 | 46 | return true; | 423 | 46 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEES3_Lb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 344 | 44 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 44 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 44 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 44 | } else { | 398 | 44 | res = from.value * scale_multiplier; | 399 | 44 | } | 400 | 44 | if constexpr (narrow_integral) { | 401 | 44 | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | 18 | } else { | 410 | 18 | if (params.is_strict) { | 411 | 9 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | 9 | decimal_to_string(from.value, scale_from), | 413 | 9 | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | 9 | precision_to, scale_to); | 415 | 9 | } | 416 | 18 | } | 417 | 18 | return false; | 418 | 18 | } | 419 | 44 | } | 420 | 26 | to = ToCppT(res); | 421 | 44 | } | 422 | 0 | return true; | 423 | 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 | 344 | 210 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 210 | MaxNativeType res; | 346 | 210 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 210 | } else { | 371 | 210 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 210 | res)) { | 373 | 36 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 36 | return false; | 380 | 174 | } else { | 381 | 174 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 78 | if (params.is_strict) { | 383 | 57 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 57 | decimal_to_string(from.value, scale_from), | 385 | 57 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 57 | precision_to, scale_to); | 387 | 57 | } | 388 | 78 | return false; | 389 | 96 | } else { | 390 | 96 | to = ToCppT(res); | 391 | 96 | } | 392 | 174 | } | 393 | 210 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 96 | return true; | 423 | 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 | 344 | 224 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 224 | MaxNativeType res; | 346 | 224 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 224 | } else { | 371 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 224 | res)) { | 373 | 20 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 20 | return false; | 380 | 204 | } else { | 381 | 204 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 100 | if (params.is_strict) { | 383 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 60 | decimal_to_string(from.value, scale_from), | 385 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 60 | precision_to, scale_to); | 387 | 60 | } | 388 | 100 | return false; | 389 | 104 | } else { | 390 | 104 | to = ToCppT(res); | 391 | 104 | } | 392 | 204 | } | 393 | 224 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 104 | return true; | 423 | 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 | 344 | 224 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 224 | MaxNativeType res; | 346 | 224 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 224 | } else { | 371 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 224 | res)) { | 373 | 20 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 20 | return false; | 380 | 204 | } else { | 381 | 204 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 100 | if (params.is_strict) { | 383 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 60 | decimal_to_string(from.value, scale_from), | 385 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 60 | precision_to, scale_to); | 387 | 60 | } | 388 | 100 | return false; | 389 | 104 | } else { | 390 | 104 | to = ToCppT(res); | 391 | 104 | } | 392 | 204 | } | 393 | 224 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 104 | return true; | 423 | 224 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 344 | 120 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 120 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 120 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 120 | } else { | 398 | 120 | res = from.value * scale_multiplier; | 399 | 120 | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | 120 | to = ToCppT(res); | 421 | 120 | } | 422 | 120 | return true; | 423 | 120 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 344 | 65 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 65 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 65 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 65 | } else { | 398 | 65 | res = from.value * scale_multiplier; | 399 | 65 | } | 400 | 65 | if constexpr (narrow_integral) { | 401 | 65 | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | 36 | } else { | 410 | 36 | if (params.is_strict) { | 411 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | 18 | decimal_to_string(from.value, scale_from), | 413 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | 18 | precision_to, scale_to); | 415 | 18 | } | 416 | 36 | } | 417 | 36 | return false; | 418 | 36 | } | 419 | 65 | } | 420 | 29 | to = ToCppT(res); | 421 | 65 | } | 422 | 0 | return true; | 423 | 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 | 344 | 65 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 65 | MaxNativeType res; | 346 | 65 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 65 | } else { | 371 | 65 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 65 | res)) { | 373 | 20 | if (params.is_strict) { | 374 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 6 | decimal_to_string(from.value, scale_from), | 376 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 6 | precision_to, scale_to); | 378 | 6 | } | 379 | 20 | return false; | 380 | 45 | } else { | 381 | 45 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 16 | if (params.is_strict) { | 383 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 12 | decimal_to_string(from.value, scale_from), | 385 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 12 | precision_to, scale_to); | 387 | 12 | } | 388 | 16 | return false; | 389 | 29 | } else { | 390 | 29 | to = ToCppT(res); | 391 | 29 | } | 392 | 45 | } | 393 | 65 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 29 | return true; | 423 | 65 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 344 | 176 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 176 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 176 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 176 | } else { | 398 | 176 | res = from.value * scale_multiplier; | 399 | 176 | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | 176 | to = ToCppT(res); | 421 | 176 | } | 422 | 176 | return true; | 423 | 176 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 344 | 116 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 116 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 116 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 116 | } else { | 398 | 116 | res = from.value * scale_multiplier; | 399 | 116 | } | 400 | 116 | if constexpr (narrow_integral) { | 401 | 116 | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | 60 | } else { | 410 | 60 | if (params.is_strict) { | 411 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | 30 | decimal_to_string(from.value, scale_from), | 413 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | 30 | precision_to, scale_to); | 415 | 30 | } | 416 | 60 | } | 417 | 60 | return false; | 418 | 60 | } | 419 | 116 | } | 420 | 56 | to = ToCppT(res); | 421 | 116 | } | 422 | 0 | return true; | 423 | 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 | 344 | 116 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 116 | MaxNativeType res; | 346 | 116 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 116 | } else { | 371 | 116 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 116 | res)) { | 373 | 36 | if (params.is_strict) { | 374 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 12 | decimal_to_string(from.value, scale_from), | 376 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 12 | precision_to, scale_to); | 378 | 12 | } | 379 | 36 | return false; | 380 | 80 | } else { | 381 | 80 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 24 | if (params.is_strict) { | 383 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 18 | decimal_to_string(from.value, scale_from), | 385 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 18 | precision_to, scale_to); | 387 | 18 | } | 388 | 24 | return false; | 389 | 56 | } else { | 390 | 56 | to = ToCppT(res); | 391 | 56 | } | 392 | 80 | } | 393 | 116 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 56 | return true; | 423 | 116 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ES2_Lb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 344 | 46 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 46 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 46 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 46 | } else { | 398 | 46 | res = from.value * scale_multiplier; | 399 | 46 | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | 46 | to = ToCppT(res); | 421 | 46 | } | 422 | 46 | return true; | 423 | 46 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ES2_Lb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 344 | 70 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 70 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 70 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 70 | } else { | 398 | 70 | res = from.value * scale_multiplier; | 399 | 70 | } | 400 | 70 | if constexpr (narrow_integral) { | 401 | 70 | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | 36 | } else { | 410 | 36 | if (params.is_strict) { | 411 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | 18 | decimal_to_string(from.value, scale_from), | 413 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | 18 | precision_to, scale_to); | 415 | 18 | } | 416 | 36 | } | 417 | 36 | return false; | 418 | 36 | } | 419 | 70 | } | 420 | 34 | to = ToCppT(res); | 421 | 70 | } | 422 | 0 | return true; | 423 | 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 | 344 | 184 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 184 | MaxNativeType res; | 346 | 184 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 184 | } else { | 371 | 184 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 184 | res)) { | 373 | 48 | if (params.is_strict) { | 374 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 12 | decimal_to_string(from.value, scale_from), | 376 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 12 | precision_to, scale_to); | 378 | 12 | } | 379 | 48 | return false; | 380 | 136 | } else { | 381 | 136 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 48 | if (params.is_strict) { | 383 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 36 | decimal_to_string(from.value, scale_from), | 385 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 36 | precision_to, scale_to); | 387 | 36 | } | 388 | 48 | return false; | 389 | 88 | } else { | 390 | 88 | to = ToCppT(res); | 391 | 88 | } | 392 | 136 | } | 393 | 184 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 88 | return true; | 423 | 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 | 344 | 224 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 224 | MaxNativeType res; | 346 | 224 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 224 | } else { | 371 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 224 | res)) { | 373 | 22 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 22 | return false; | 380 | 202 | } else { | 381 | 202 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 98 | if (params.is_strict) { | 383 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 60 | decimal_to_string(from.value, scale_from), | 385 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 60 | precision_to, scale_to); | 387 | 60 | } | 388 | 98 | return false; | 389 | 104 | } else { | 390 | 104 | to = ToCppT(res); | 391 | 104 | } | 392 | 202 | } | 393 | 224 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 104 | return true; | 423 | 224 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 344 | 120 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 120 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 120 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 120 | } else { | 398 | 120 | res = from.value * scale_multiplier; | 399 | 120 | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | 120 | to = ToCppT(res); | 421 | 120 | } | 422 | 120 | return true; | 423 | 120 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 344 | 65 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 65 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 65 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 65 | } else { | 398 | 65 | res = from.value * scale_multiplier; | 399 | 65 | } | 400 | 65 | if constexpr (narrow_integral) { | 401 | 65 | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | 36 | } else { | 410 | 36 | if (params.is_strict) { | 411 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | 18 | decimal_to_string(from.value, scale_from), | 413 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | 18 | precision_to, scale_to); | 415 | 18 | } | 416 | 36 | } | 417 | 36 | return false; | 418 | 36 | } | 419 | 65 | } | 420 | 29 | to = ToCppT(res); | 421 | 65 | } | 422 | 0 | return true; | 423 | 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 | 344 | 65 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 65 | MaxNativeType res; | 346 | 65 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 65 | } else { | 371 | 65 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 65 | res)) { | 373 | 12 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 12 | return false; | 380 | 53 | } else { | 381 | 53 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 24 | if (params.is_strict) { | 383 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 18 | decimal_to_string(from.value, scale_from), | 385 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 18 | precision_to, scale_to); | 387 | 18 | } | 388 | 24 | return false; | 389 | 29 | } else { | 390 | 29 | to = ToCppT(res); | 391 | 29 | } | 392 | 53 | } | 393 | 65 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 29 | return true; | 423 | 65 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 344 | 184 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 184 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 184 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 184 | } else { | 398 | 184 | res = from.value * scale_multiplier; | 399 | 184 | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | 184 | to = ToCppT(res); | 421 | 184 | } | 422 | 184 | return true; | 423 | 184 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 344 | 116 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 116 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 116 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 116 | } else { | 398 | 116 | res = from.value * scale_multiplier; | 399 | 116 | } | 400 | 116 | if constexpr (narrow_integral) { | 401 | 116 | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | 60 | } else { | 410 | 60 | if (params.is_strict) { | 411 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | 30 | decimal_to_string(from.value, scale_from), | 413 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | 30 | precision_to, scale_to); | 415 | 30 | } | 416 | 60 | } | 417 | 60 | return false; | 418 | 60 | } | 419 | 116 | } | 420 | 56 | to = ToCppT(res); | 421 | 116 | } | 422 | 0 | return true; | 423 | 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 | 344 | 116 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 116 | MaxNativeType res; | 346 | 116 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 116 | } else { | 371 | 116 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 116 | res)) { | 373 | 20 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 20 | return false; | 380 | 96 | } else { | 381 | 96 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 40 | if (params.is_strict) { | 383 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 30 | decimal_to_string(from.value, scale_from), | 385 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 30 | precision_to, scale_to); | 387 | 30 | } | 388 | 40 | return false; | 389 | 56 | } else { | 390 | 56 | to = ToCppT(res); | 391 | 56 | } | 392 | 96 | } | 393 | 116 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 56 | return true; | 423 | 116 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 344 | 176 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 176 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 176 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 176 | } else { | 398 | 176 | res = from.value * scale_multiplier; | 399 | 176 | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | 176 | to = ToCppT(res); | 421 | 176 | } | 422 | 176 | return true; | 423 | 176 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 344 | 109 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 109 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 109 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 109 | } else { | 398 | 109 | res = from.value * scale_multiplier; | 399 | 109 | } | 400 | 109 | if constexpr (narrow_integral) { | 401 | 109 | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | 54 | } else { | 410 | 54 | if (params.is_strict) { | 411 | 27 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | 27 | decimal_to_string(from.value, scale_from), | 413 | 27 | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | 27 | precision_to, scale_to); | 415 | 27 | } | 416 | 54 | } | 417 | 54 | return false; | 418 | 54 | } | 419 | 109 | } | 420 | 55 | to = ToCppT(res); | 421 | 109 | } | 422 | 0 | return true; | 423 | 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 | 344 | 123 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 123 | MaxNativeType res; | 346 | 123 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 123 | } else { | 371 | 123 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 123 | res)) { | 373 | 22 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 22 | return false; | 380 | 101 | } else { | 381 | 101 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 44 | if (params.is_strict) { | 383 | 33 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 33 | decimal_to_string(from.value, scale_from), | 385 | 33 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 33 | precision_to, scale_to); | 387 | 33 | } | 388 | 44 | return false; | 389 | 57 | } else { | 390 | 57 | to = ToCppT(res); | 391 | 57 | } | 392 | 101 | } | 393 | 123 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 57 | return true; | 423 | 123 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 344 | 46 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 46 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 46 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 46 | } else { | 398 | 46 | res = from.value * scale_multiplier; | 399 | 46 | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | 46 | to = ToCppT(res); | 421 | 46 | } | 422 | 46 | return true; | 423 | 46 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 344 | 44 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 44 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 44 | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | 44 | } else { | 398 | 44 | res = from.value * scale_multiplier; | 399 | 44 | } | 400 | 44 | if constexpr (narrow_integral) { | 401 | 44 | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | 18 | } else { | 410 | 18 | if (params.is_strict) { | 411 | 9 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | 9 | decimal_to_string(from.value, scale_from), | 413 | 9 | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | 9 | precision_to, scale_to); | 415 | 9 | } | 416 | 18 | } | 417 | 18 | return false; | 418 | 18 | } | 419 | 44 | } | 420 | 26 | to = ToCppT(res); | 421 | 44 | } | 422 | 0 | return true; | 423 | 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 | 344 | 210 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 210 | MaxNativeType res; | 346 | 210 | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | 210 | } else { | 371 | 210 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | 210 | res)) { | 373 | 38 | if (params.is_strict) { | 374 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | 0 | decimal_to_string(from.value, scale_from), | 376 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | 0 | precision_to, scale_to); | 378 | 0 | } | 379 | 38 | return false; | 380 | 172 | } else { | 381 | 172 | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | 76 | if (params.is_strict) { | 383 | 57 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | 57 | decimal_to_string(from.value, scale_from), | 385 | 57 | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | 57 | precision_to, scale_to); | 387 | 57 | } | 388 | 76 | return false; | 389 | 96 | } else { | 390 | 96 | to = ToCppT(res); | 391 | 96 | } | 392 | 172 | } | 393 | 210 | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 96 | return true; | 423 | 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 | 344 | 15 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 15 | MaxNativeType res; | 346 | 15 | if constexpr (multiply_may_overflow) { | 347 | 15 | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | 15 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | 15 | res)) { | 350 | 0 | if (params.is_strict) { | 351 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | 0 | decimal_to_string(from.value(), scale_from), | 353 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | 0 | precision_to, scale_to); | 355 | 0 | } | 356 | 0 | return false; | 357 | 15 | } else { | 358 | 15 | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | 0 | if (params.is_strict) { | 360 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | 0 | decimal_to_string(from.value(), scale_from), | 362 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | 0 | precision_to, scale_to); | 364 | 0 | } | 365 | 0 | return false; | 366 | 15 | } else { | 367 | 15 | to = ToCppT(res); | 368 | 15 | } | 369 | 15 | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 15 | return true; | 423 | 15 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 344 | 130 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 130 | MaxNativeType res; | 346 | 130 | if constexpr (multiply_may_overflow) { | 347 | 130 | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | 130 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | 130 | res)) { | 350 | 0 | if (params.is_strict) { | 351 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | 0 | decimal_to_string(from.value(), scale_from), | 353 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | 0 | precision_to, scale_to); | 355 | 0 | } | 356 | 0 | return false; | 357 | 130 | } else { | 358 | 130 | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | 48 | if (params.is_strict) { | 360 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | 24 | decimal_to_string(from.value(), scale_from), | 362 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | 24 | precision_to, scale_to); | 364 | 24 | } | 365 | 48 | return false; | 366 | 82 | } else { | 367 | 82 | to = ToCppT(res); | 368 | 82 | } | 369 | 130 | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 82 | return true; | 423 | 130 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 344 | 11 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 11 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 11 | } else { | 395 | 11 | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | 11 | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | 11 | to = ToCppT(res); | 421 | 11 | } | 422 | 11 | return true; | 423 | 11 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 344 | 95 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 95 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 95 | } else { | 395 | 95 | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | 95 | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | 95 | if constexpr (narrow_integral) { | 401 | 95 | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | 30 | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | 30 | if (params.is_strict) { | 404 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | 15 | decimal_to_string(from.value(), scale_from), | 406 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | 15 | precision_to, scale_to); | 408 | 15 | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | 30 | return false; | 418 | 30 | } | 419 | 95 | } | 420 | 65 | to = ToCppT(res); | 421 | 95 | } | 422 | 0 | return true; | 423 | 95 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 344 | 11 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 11 | MaxNativeType res; | 346 | 11 | if constexpr (multiply_may_overflow) { | 347 | 11 | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | 11 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | 11 | res)) { | 350 | 0 | if (params.is_strict) { | 351 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | 0 | decimal_to_string(from.value(), scale_from), | 353 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | 0 | precision_to, scale_to); | 355 | 0 | } | 356 | 0 | return false; | 357 | 11 | } else { | 358 | 11 | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | 0 | if (params.is_strict) { | 360 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | 0 | decimal_to_string(from.value(), scale_from), | 362 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | 0 | precision_to, scale_to); | 364 | 0 | } | 365 | 0 | return false; | 366 | 11 | } else { | 367 | 11 | to = ToCppT(res); | 368 | 11 | } | 369 | 11 | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 11 | return true; | 423 | 11 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 344 | 95 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 95 | MaxNativeType res; | 346 | 95 | if constexpr (multiply_may_overflow) { | 347 | 95 | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | 95 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | 95 | res)) { | 350 | 18 | if (params.is_strict) { | 351 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | 6 | decimal_to_string(from.value(), scale_from), | 353 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | 6 | precision_to, scale_to); | 355 | 6 | } | 356 | 18 | return false; | 357 | 77 | } else { | 358 | 77 | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | 12 | if (params.is_strict) { | 360 | 9 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | 9 | decimal_to_string(from.value(), scale_from), | 362 | 9 | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | 9 | precision_to, scale_to); | 364 | 9 | } | 365 | 12 | return false; | 366 | 65 | } else { | 367 | 65 | to = ToCppT(res); | 368 | 65 | } | 369 | 77 | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 65 | return true; | 423 | 95 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 344 | 11 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 11 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 11 | } else { | 395 | 11 | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | 11 | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | 11 | to = ToCppT(res); | 421 | 11 | } | 422 | 11 | return true; | 423 | 11 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 344 | 95 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 95 | MaxNativeType res; | 346 | | if constexpr (multiply_may_overflow) { | 347 | | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | | res)) { | 350 | | if (params.is_strict) { | 351 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | | decimal_to_string(from.value(), scale_from), | 353 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | | precision_to, scale_to); | 355 | | } | 356 | | return false; | 357 | | } else { | 358 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | | if (params.is_strict) { | 360 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | | decimal_to_string(from.value(), scale_from), | 362 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | | precision_to, scale_to); | 364 | | } | 365 | | return false; | 366 | | } else { | 367 | | to = ToCppT(res); | 368 | | } | 369 | | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | 95 | } else { | 395 | 95 | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | 95 | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | 95 | if constexpr (narrow_integral) { | 401 | 95 | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | 30 | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | 30 | if (params.is_strict) { | 404 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | 15 | decimal_to_string(from.value(), scale_from), | 406 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | 15 | precision_to, scale_to); | 408 | 15 | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | 30 | return false; | 418 | 30 | } | 419 | 95 | } | 420 | 65 | to = ToCppT(res); | 421 | 95 | } | 422 | 0 | return true; | 423 | 95 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 344 | 11 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 11 | MaxNativeType res; | 346 | 11 | if constexpr (multiply_may_overflow) { | 347 | 11 | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | 11 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | 11 | res)) { | 350 | 0 | if (params.is_strict) { | 351 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | 0 | decimal_to_string(from.value(), scale_from), | 353 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | 0 | precision_to, scale_to); | 355 | 0 | } | 356 | 0 | return false; | 357 | 11 | } else { | 358 | 11 | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | 0 | if (params.is_strict) { | 360 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | 0 | decimal_to_string(from.value(), scale_from), | 362 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | 0 | precision_to, scale_to); | 364 | 0 | } | 365 | 0 | return false; | 366 | 11 | } else { | 367 | 11 | to = ToCppT(res); | 368 | 11 | } | 369 | 11 | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 11 | return true; | 423 | 11 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 344 | 95 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 345 | 95 | MaxNativeType res; | 346 | 95 | if constexpr (multiply_may_overflow) { | 347 | 95 | if constexpr (IsDecimal128V2<FromCppT>) { | 348 | 95 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 349 | 95 | res)) { | 350 | 10 | if (params.is_strict) { | 351 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 352 | 0 | decimal_to_string(from.value(), scale_from), | 353 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 354 | 0 | precision_to, scale_to); | 355 | 0 | } | 356 | 10 | return false; | 357 | 85 | } else { | 358 | 85 | if (UNLIKELY(res > max_result || res < -max_result)) { | 359 | 20 | if (params.is_strict) { | 360 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 361 | 15 | decimal_to_string(from.value(), scale_from), | 362 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), | 363 | 15 | precision_to, scale_to); | 364 | 15 | } | 365 | 20 | return false; | 366 | 65 | } else { | 367 | 65 | to = ToCppT(res); | 368 | 65 | } | 369 | 85 | } | 370 | | } else { | 371 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 372 | | res)) { | 373 | | if (params.is_strict) { | 374 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 375 | | decimal_to_string(from.value, scale_from), | 376 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 377 | | precision_to, scale_to); | 378 | | } | 379 | | return false; | 380 | | } else { | 381 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 382 | | if (params.is_strict) { | 383 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 384 | | decimal_to_string(from.value, scale_from), | 385 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 386 | | precision_to, scale_to); | 387 | | } | 388 | | return false; | 389 | | } else { | 390 | | to = ToCppT(res); | 391 | | } | 392 | | } | 393 | | } | 394 | | } else { | 395 | | if constexpr (IsDecimal128V2<FromCppT>) { | 396 | | res = from.value() * scale_multiplier; | 397 | | } else { | 398 | | res = from.value * scale_multiplier; | 399 | | } | 400 | | if constexpr (narrow_integral) { | 401 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 402 | | if constexpr (IsDecimal128V2<FromCppT>) { | 403 | | if (params.is_strict) { | 404 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 405 | | decimal_to_string(from.value(), scale_from), | 406 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 407 | | precision_to, scale_to); | 408 | | } | 409 | | } else { | 410 | | if (params.is_strict) { | 411 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 412 | | decimal_to_string(from.value, scale_from), | 413 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 414 | | precision_to, scale_to); | 415 | | } | 416 | | } | 417 | | return false; | 418 | | } | 419 | | } | 420 | | to = ToCppT(res); | 421 | | } | 422 | 65 | return true; | 423 | 95 | } |
|
424 | | |
425 | | template <typename FromCppT, typename ToCppT, typename ScaleT, bool narrow_integral> |
426 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
427 | | static inline bool _from_decimal_same_scale(const FromCppT& from, const UInt32 precision_from, |
428 | | const UInt32 scale_from, ToCppT& to, |
429 | | UInt32 precision_to, UInt32 scale_to, |
430 | | const typename ToCppT::NativeType& min_result, |
431 | | const typename ToCppT::NativeType& max_result, |
432 | 1.86k | CastParameters& params) { |
433 | 1.86k | if constexpr (IsDecimal128V2<FromCppT>) { |
434 | 106 | if constexpr (narrow_integral) { |
435 | 95 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { |
436 | 30 | if (params.is_strict) { |
437 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
438 | 15 | decimal_to_string(from.value(), scale_from), |
439 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), |
440 | 15 | precision_to, scale_to); |
441 | 15 | } |
442 | 30 | return false; |
443 | 30 | } |
444 | 95 | } |
445 | 65 | to = ToCppT(from.value()); |
446 | 1.76k | } else { |
447 | 1.76k | if constexpr (narrow_integral) { |
448 | 1.05k | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { |
449 | 354 | if (params.is_strict) { |
450 | 177 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
451 | 177 | decimal_to_string(from.value, scale_from), |
452 | 177 | fmt::format("decimal({}, {})", precision_from, scale_from), |
453 | 177 | precision_to, scale_to); |
454 | 177 | } |
455 | 354 | return false; |
456 | 354 | } |
457 | 1.05k | } |
458 | 703 | to = ToCppT(from.value); |
459 | 1.76k | } |
460 | 0 | return true; |
461 | 1.86k | } _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEES3_iLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 432 | 8 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 8 | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | 8 | to = ToCppT(from.value); | 459 | 8 | } | 460 | 8 | return true; | 461 | 8 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEES3_iLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 432 | 19 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 19 | } else { | 447 | 19 | if constexpr (narrow_integral) { | 448 | 19 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | 12 | if (params.is_strict) { | 450 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | 6 | decimal_to_string(from.value, scale_from), | 452 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | 6 | precision_to, scale_to); | 454 | 6 | } | 455 | 12 | return false; | 456 | 12 | } | 457 | 19 | } | 458 | 7 | to = ToCppT(from.value); | 459 | 19 | } | 460 | 0 | return true; | 461 | 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 | 432 | 136 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 136 | } else { | 447 | 136 | if constexpr (narrow_integral) { | 448 | 136 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | 54 | if (params.is_strict) { | 450 | 27 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | 27 | decimal_to_string(from.value, scale_from), | 452 | 27 | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | 27 | precision_to, scale_to); | 454 | 27 | } | 455 | 54 | return false; | 456 | 54 | } | 457 | 136 | } | 458 | 82 | to = ToCppT(from.value); | 459 | 136 | } | 460 | 0 | return true; | 461 | 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 | 432 | 122 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 122 | } else { | 447 | 122 | if constexpr (narrow_integral) { | 448 | 122 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | 48 | if (params.is_strict) { | 450 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | 24 | decimal_to_string(from.value, scale_from), | 452 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | 24 | precision_to, scale_to); | 454 | 24 | } | 455 | 48 | return false; | 456 | 48 | } | 457 | 122 | } | 458 | 74 | to = ToCppT(from.value); | 459 | 122 | } | 460 | 0 | return true; | 461 | 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 | 432 | 122 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 122 | } else { | 447 | 122 | if constexpr (narrow_integral) { | 448 | 122 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | 48 | if (params.is_strict) { | 450 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | 24 | decimal_to_string(from.value, scale_from), | 452 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | 24 | precision_to, scale_to); | 454 | 24 | } | 455 | 48 | return false; | 456 | 48 | } | 457 | 122 | } | 458 | 74 | to = ToCppT(from.value); | 459 | 122 | } | 460 | 0 | return true; | 461 | 122 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS2_IlEElLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 432 | 82 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 82 | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | 82 | to = ToCppT(from.value); | 459 | 82 | } | 460 | 82 | return true; | 461 | 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 | 432 | 30 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 30 | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | 30 | to = ToCppT(from.value); | 459 | 30 | } | 460 | 30 | return true; | 461 | 30 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIlEES3_lLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 432 | 42 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 42 | } else { | 447 | 42 | if constexpr (narrow_integral) { | 448 | 42 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | 12 | if (params.is_strict) { | 450 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | 6 | decimal_to_string(from.value, scale_from), | 452 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | 6 | precision_to, scale_to); | 454 | 6 | } | 455 | 12 | return false; | 456 | 12 | } | 457 | 42 | } | 458 | 30 | to = ToCppT(from.value); | 459 | 42 | } | 460 | 0 | return true; | 461 | 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 | 432 | 182 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 182 | } else { | 447 | 182 | if constexpr (narrow_integral) { | 448 | 182 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | 54 | if (params.is_strict) { | 450 | 27 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | 27 | decimal_to_string(from.value, scale_from), | 452 | 27 | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | 27 | precision_to, scale_to); | 454 | 27 | } | 455 | 54 | return false; | 456 | 54 | } | 457 | 182 | } | 458 | 128 | to = ToCppT(from.value); | 459 | 182 | } | 460 | 0 | return true; | 461 | 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 | 432 | 168 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 168 | } else { | 447 | 168 | if constexpr (narrow_integral) { | 448 | 168 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | 48 | if (params.is_strict) { | 450 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | 24 | decimal_to_string(from.value, scale_from), | 452 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | 24 | precision_to, scale_to); | 454 | 24 | } | 455 | 48 | return false; | 456 | 48 | } | 457 | 168 | } | 458 | 120 | to = ToCppT(from.value); | 459 | 168 | } | 460 | 0 | return true; | 461 | 168 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS_12Decimal128V3EnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 432 | 74 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 74 | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | 74 | to = ToCppT(from.value); | 459 | 74 | } | 460 | 74 | return true; | 461 | 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 | 432 | 128 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 128 | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | 128 | to = ToCppT(from.value); | 459 | 128 | } | 460 | 128 | return true; | 461 | 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 | 432 | 31 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 31 | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | 31 | to = ToCppT(from.value); | 459 | 31 | } | 460 | 31 | return true; | 461 | 31 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_12Decimal128V3ES2_nLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RNS_14CastParametersE Line | Count | Source | 432 | 42 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 42 | } else { | 447 | 42 | if constexpr (narrow_integral) { | 448 | 42 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | 12 | if (params.is_strict) { | 450 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | 6 | decimal_to_string(from.value, scale_from), | 452 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | 6 | precision_to, scale_to); | 454 | 6 | } | 455 | 12 | return false; | 456 | 12 | } | 457 | 42 | } | 458 | 30 | to = ToCppT(from.value); | 459 | 42 | } | 460 | 0 | return true; | 461 | 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 | 432 | 182 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 182 | } else { | 447 | 182 | if constexpr (narrow_integral) { | 448 | 182 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | 54 | if (params.is_strict) { | 450 | 27 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | 27 | decimal_to_string(from.value, scale_from), | 452 | 27 | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | 27 | precision_to, scale_to); | 454 | 27 | } | 455 | 54 | return false; | 456 | 54 | } | 457 | 182 | } | 458 | 128 | to = ToCppT(from.value); | 459 | 182 | } | 460 | 0 | return true; | 461 | 182 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES6_Lb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 432 | 74 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 74 | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | 74 | to = ToCppT(from.value); | 459 | 74 | } | 460 | 74 | return true; | 461 | 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 | 432 | 120 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 120 | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | 120 | to = ToCppT(from.value); | 459 | 120 | } | 460 | 120 | return true; | 461 | 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 | 432 | 128 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 128 | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | 128 | to = ToCppT(from.value); | 459 | 128 | } | 460 | 128 | return true; | 461 | 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 | 432 | 30 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 30 | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | 30 | to = ToCppT(from.value); | 459 | 30 | } | 460 | 30 | return true; | 461 | 30 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_S5_Lb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 432 | 42 | CastParameters& params) { | 433 | | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | | to = ToCppT(from.value()); | 446 | 42 | } else { | 447 | 42 | if constexpr (narrow_integral) { | 448 | 42 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | 12 | if (params.is_strict) { | 450 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | 6 | decimal_to_string(from.value, scale_from), | 452 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | 6 | precision_to, scale_to); | 454 | 6 | } | 455 | 12 | return false; | 456 | 12 | } | 457 | 42 | } | 458 | 30 | to = ToCppT(from.value); | 459 | 42 | } | 460 | 0 | return true; | 461 | 42 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIiEEnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 432 | 4 | CastParameters& params) { | 433 | 4 | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | 4 | to = ToCppT(from.value()); | 446 | | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | | to = ToCppT(from.value); | 459 | | } | 460 | 4 | return true; | 461 | 4 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIiEEnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 432 | 35 | CastParameters& params) { | 433 | 35 | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | 35 | if constexpr (narrow_integral) { | 435 | 35 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | 18 | if (params.is_strict) { | 437 | 9 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | 9 | decimal_to_string(from.value(), scale_from), | 439 | 9 | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | 9 | precision_to, scale_to); | 441 | 9 | } | 442 | 18 | return false; | 443 | 18 | } | 444 | 35 | } | 445 | 17 | to = ToCppT(from.value()); | 446 | | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | | to = ToCppT(from.value); | 459 | | } | 460 | 0 | return true; | 461 | 35 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIlEEnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 432 | 7 | CastParameters& params) { | 433 | 7 | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | | if constexpr (narrow_integral) { | 435 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | | if (params.is_strict) { | 437 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | | decimal_to_string(from.value(), scale_from), | 439 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | | precision_to, scale_to); | 441 | | } | 442 | | return false; | 443 | | } | 444 | | } | 445 | 7 | to = ToCppT(from.value()); | 446 | | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | | to = ToCppT(from.value); | 459 | | } | 460 | 7 | return true; | 461 | 7 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIlEEnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 432 | 60 | CastParameters& params) { | 433 | 60 | if constexpr (IsDecimal128V2<FromCppT>) { | 434 | 60 | if constexpr (narrow_integral) { | 435 | 60 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 436 | 12 | if (params.is_strict) { | 437 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 438 | 6 | decimal_to_string(from.value(), scale_from), | 439 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 440 | 6 | precision_to, scale_to); | 441 | 6 | } | 442 | 12 | return false; | 443 | 12 | } | 444 | 60 | } | 445 | 48 | to = ToCppT(from.value()); | 446 | | } else { | 447 | | if constexpr (narrow_integral) { | 448 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 449 | | if (params.is_strict) { | 450 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 451 | | decimal_to_string(from.value, scale_from), | 452 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 453 | | precision_to, scale_to); | 454 | | } | 455 | | return false; | 456 | | } | 457 | | } | 458 | | to = ToCppT(from.value); | 459 | | } | 460 | 0 | return true; | 461 | 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 |
462 | | |
463 | | template < |
464 | | typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
465 | | typename MaxNativeType = std::conditional_t< |
466 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
467 | | (std::is_same_v<ToCppT, Decimal128V3> || |
468 | | std::is_same_v<FromCppT, Decimal128V3>), |
469 | | Decimal128V3::NativeType, |
470 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), |
471 | | typename FromCppT::NativeType, typename ToCppT::NativeType>>> |
472 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
473 | | static inline bool _from_decimal_bigger_scale(const FromCppT& from, const UInt32 precision_from, |
474 | | const UInt32 scale_from, ToCppT& to, |
475 | | UInt32 precision_to, UInt32 scale_to, |
476 | | const MaxNativeType& scale_multiplier, |
477 | | const typename ToCppT::NativeType& min_result, |
478 | | const typename ToCppT::NativeType& max_result, |
479 | 8.38k | CastParameters& params) { |
480 | 8.38k | MaxNativeType res; |
481 | 8.38k | if (from >= FromCppT(0)) { |
482 | 8.38k | if constexpr (narrow_integral) { |
483 | 3.33k | if constexpr (IsDecimal128V2<FromCppT>) { |
484 | 839 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; |
485 | 839 | if (UNLIKELY(res > max_result)) { |
486 | 244 | if (params.is_strict) { |
487 | 122 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
488 | 122 | decimal_to_string(from.value(), scale_from), |
489 | 122 | fmt::format("decimal({}, {})", precision_from, scale_from), |
490 | 122 | precision_to, scale_to); |
491 | 122 | } |
492 | 244 | return false; |
493 | 244 | } |
494 | 2.49k | } else { |
495 | 2.49k | res = (from.value + scale_multiplier / 2) / scale_multiplier; |
496 | 2.49k | if (UNLIKELY(res > max_result)) { |
497 | 1.03k | if (params.is_strict) { |
498 | 518 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
499 | 518 | decimal_to_string(from.value, scale_from), |
500 | 518 | fmt::format("decimal({}, {})", precision_from, scale_from), |
501 | 518 | precision_to, scale_to); |
502 | 518 | } |
503 | 1.03k | return false; |
504 | 1.03k | } |
505 | 2.49k | } |
506 | 2.04k | to = ToCppT(res); |
507 | 5.05k | } else { |
508 | 5.05k | if constexpr (IsDecimal128V2<FromCppT>) { |
509 | 932 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); |
510 | 4.12k | } else { |
511 | 4.12k | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); |
512 | 4.12k | } |
513 | 5.05k | } |
514 | 8.38k | } else { |
515 | 0 | if constexpr (narrow_integral) { |
516 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { |
517 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; |
518 | 0 | if (UNLIKELY(res < -max_result)) { |
519 | 0 | if (params.is_strict) { |
520 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
521 | 0 | decimal_to_string(from.value(), scale_from), |
522 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), |
523 | 0 | precision_to, scale_to); |
524 | 0 | } |
525 | 0 | return false; |
526 | 0 | } |
527 | 0 | } else { |
528 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; |
529 | 0 | if (UNLIKELY(res < -max_result)) { |
530 | 0 | if (params.is_strict) { |
531 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
532 | 0 | decimal_to_string(from.value, scale_from), |
533 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), |
534 | 0 | precision_to, scale_to); |
535 | 0 | } |
536 | 0 | return false; |
537 | 0 | } |
538 | 0 | } |
539 | 0 | to = ToCppT(res); |
540 | 0 | } else { |
541 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { |
542 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); |
543 | 0 | } else { |
544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); |
545 | 0 | } |
546 | 0 | } |
547 | 0 | } |
548 | 0 | return true; |
549 | 8.38k | } _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEES3_Lb0ELb0EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 479 | 112 | CastParameters& params) { | 480 | 112 | MaxNativeType res; | 481 | 112 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 112 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 112 | } else { | 511 | 112 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 112 | } | 513 | 112 | } | 514 | 112 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 112 | return true; | 549 | 112 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEES3_Lb0ELb1EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 479 | 82 | CastParameters& params) { | 480 | 82 | MaxNativeType res; | 481 | 82 | if (from >= FromCppT(0)) { | 482 | 82 | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | 82 | } else { | 495 | 82 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | 82 | if (UNLIKELY(res > max_result)) { | 497 | 40 | if (params.is_strict) { | 498 | 20 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | 20 | decimal_to_string(from.value, scale_from), | 500 | 20 | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | 20 | precision_to, scale_to); | 502 | 20 | } | 503 | 40 | return false; | 504 | 40 | } | 505 | 82 | } | 506 | 42 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 82 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | 0 | } else { | 528 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | 0 | if (UNLIKELY(res < -max_result)) { | 530 | 0 | if (params.is_strict) { | 531 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | 0 | decimal_to_string(from.value, scale_from), | 533 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | 0 | precision_to, scale_to); | 535 | 0 | } | 536 | 0 | return false; | 537 | 0 | } | 538 | 0 | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 160 | CastParameters& params) { | 480 | 160 | MaxNativeType res; | 481 | 160 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 160 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 160 | } else { | 511 | 160 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 160 | } | 513 | 160 | } | 514 | 160 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 160 | return true; | 549 | 160 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS2_IiEELb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 479 | 323 | CastParameters& params) { | 480 | 323 | MaxNativeType res; | 481 | 323 | if (from >= FromCppT(0)) { | 482 | 323 | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | 323 | } else { | 495 | 323 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | 323 | if (UNLIKELY(res > max_result)) { | 497 | 133 | if (params.is_strict) { | 498 | 66 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | 66 | decimal_to_string(from.value, scale_from), | 500 | 66 | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | 66 | precision_to, scale_to); | 502 | 66 | } | 503 | 133 | return false; | 504 | 133 | } | 505 | 323 | } | 506 | 190 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 323 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | 0 | } else { | 528 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | 0 | if (UNLIKELY(res < -max_result)) { | 530 | 0 | if (params.is_strict) { | 531 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | 0 | decimal_to_string(from.value, scale_from), | 533 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | 0 | precision_to, scale_to); | 535 | 0 | } | 536 | 0 | return false; | 537 | 0 | } | 538 | 0 | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 160 | CastParameters& params) { | 480 | 160 | MaxNativeType res; | 481 | 160 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 160 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 160 | } else { | 511 | 160 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 160 | } | 513 | 160 | } | 514 | 160 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 160 | return true; | 549 | 160 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIiEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 479 | 357 | CastParameters& params) { | 480 | 357 | MaxNativeType res; | 481 | 357 | if (from >= FromCppT(0)) { | 482 | 357 | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | 357 | } else { | 495 | 357 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | 357 | if (UNLIKELY(res > max_result)) { | 497 | 161 | if (params.is_strict) { | 498 | 80 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | 80 | decimal_to_string(from.value, scale_from), | 500 | 80 | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | 80 | precision_to, scale_to); | 502 | 80 | } | 503 | 161 | return false; | 504 | 161 | } | 505 | 357 | } | 506 | 196 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 357 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | 0 | } else { | 528 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | 0 | if (UNLIKELY(res < -max_result)) { | 530 | 0 | if (params.is_strict) { | 531 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | 0 | decimal_to_string(from.value, scale_from), | 533 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | 0 | precision_to, scale_to); | 535 | 0 | } | 536 | 0 | return false; | 537 | 0 | } | 538 | 0 | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 160 | CastParameters& params) { | 480 | 160 | MaxNativeType res; | 481 | 160 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 160 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 160 | } else { | 511 | 160 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 160 | } | 513 | 160 | } | 514 | 160 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 160 | return true; | 549 | 160 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 479 | 357 | CastParameters& params) { | 480 | 357 | MaxNativeType res; | 481 | 357 | if (from >= FromCppT(0)) { | 482 | 357 | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | 357 | } else { | 495 | 357 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | 357 | if (UNLIKELY(res > max_result)) { | 497 | 161 | if (params.is_strict) { | 498 | 80 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | 80 | decimal_to_string(from.value, scale_from), | 500 | 80 | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | 80 | precision_to, scale_to); | 502 | 80 | } | 503 | 161 | return false; | 504 | 161 | } | 505 | 357 | } | 506 | 196 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 357 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | 0 | } else { | 528 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | 0 | if (UNLIKELY(res < -max_result)) { | 530 | 0 | if (params.is_strict) { | 531 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | 0 | decimal_to_string(from.value, scale_from), | 533 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | 0 | precision_to, scale_to); | 535 | 0 | } | 536 | 0 | return false; | 537 | 0 | } | 538 | 0 | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 184 | CastParameters& params) { | 480 | 184 | MaxNativeType res; | 481 | 184 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 184 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 184 | } else { | 511 | 184 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 184 | } | 513 | 184 | } | 514 | 184 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 184 | return true; | 549 | 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 | 479 | 352 | CastParameters& params) { | 480 | 352 | MaxNativeType res; | 481 | 352 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 352 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 352 | } else { | 511 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 352 | } | 513 | 352 | } | 514 | 352 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 352 | return true; | 549 | 352 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEES3_Lb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 479 | 96 | CastParameters& params) { | 480 | 96 | MaxNativeType res; | 481 | 96 | if (from >= FromCppT(0)) { | 482 | 96 | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | 96 | } else { | 495 | 96 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | 96 | if (UNLIKELY(res > max_result)) { | 497 | 40 | if (params.is_strict) { | 498 | 20 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | 20 | decimal_to_string(from.value, scale_from), | 500 | 20 | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | 20 | precision_to, scale_to); | 502 | 20 | } | 503 | 40 | return false; | 504 | 40 | } | 505 | 96 | } | 506 | 56 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 96 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | 0 | } else { | 528 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | 0 | if (UNLIKELY(res < -max_result)) { | 530 | 0 | if (params.is_strict) { | 531 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | 0 | decimal_to_string(from.value, scale_from), | 533 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | 0 | precision_to, scale_to); | 535 | 0 | } | 536 | 0 | return false; | 537 | 0 | } | 538 | 0 | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 288 | CastParameters& params) { | 480 | 288 | MaxNativeType res; | 481 | 288 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 288 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 288 | } else { | 511 | 288 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 288 | } | 513 | 288 | } | 514 | 288 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 288 | return true; | 549 | 288 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIlEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 479 | 350 | CastParameters& params) { | 480 | 350 | MaxNativeType res; | 481 | 350 | if (from >= FromCppT(0)) { | 482 | 350 | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | 350 | } else { | 495 | 350 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | 350 | if (UNLIKELY(res > max_result)) { | 497 | 132 | if (params.is_strict) { | 498 | 66 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | 66 | decimal_to_string(from.value, scale_from), | 500 | 66 | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | 66 | precision_to, scale_to); | 502 | 66 | } | 503 | 132 | return false; | 504 | 132 | } | 505 | 350 | } | 506 | 218 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 350 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | 0 | } else { | 528 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | 0 | if (UNLIKELY(res < -max_result)) { | 530 | 0 | if (params.is_strict) { | 531 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | 0 | decimal_to_string(from.value, scale_from), | 533 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | 0 | precision_to, scale_to); | 535 | 0 | } | 536 | 0 | return false; | 537 | 0 | } | 538 | 0 | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 288 | CastParameters& params) { | 480 | 288 | MaxNativeType res; | 481 | 288 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 288 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 288 | } else { | 511 | 288 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 288 | } | 513 | 288 | } | 514 | 288 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 288 | return true; | 549 | 288 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 479 | 384 | CastParameters& params) { | 480 | 384 | MaxNativeType res; | 481 | 384 | if (from >= FromCppT(0)) { | 482 | 384 | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | 384 | } else { | 495 | 384 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | 384 | if (UNLIKELY(res > max_result)) { | 497 | 160 | if (params.is_strict) { | 498 | 80 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | 80 | decimal_to_string(from.value, scale_from), | 500 | 80 | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | 80 | precision_to, scale_to); | 502 | 80 | } | 503 | 160 | return false; | 504 | 160 | } | 505 | 384 | } | 506 | 224 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 384 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | 0 | } else { | 528 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | 0 | if (UNLIKELY(res < -max_result)) { | 530 | 0 | if (params.is_strict) { | 531 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | 0 | decimal_to_string(from.value, scale_from), | 533 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | 0 | precision_to, scale_to); | 535 | 0 | } | 536 | 0 | return false; | 537 | 0 | } | 538 | 0 | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 184 | CastParameters& params) { | 480 | 184 | MaxNativeType res; | 481 | 184 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 184 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 184 | } else { | 511 | 184 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 184 | } | 513 | 184 | } | 514 | 184 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 184 | return true; | 549 | 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 | 479 | 352 | CastParameters& params) { | 480 | 352 | MaxNativeType res; | 481 | 352 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 352 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 352 | } else { | 511 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 352 | } | 513 | 352 | } | 514 | 352 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 352 | return true; | 549 | 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 | 479 | 352 | CastParameters& params) { | 480 | 352 | MaxNativeType res; | 481 | 352 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 352 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 352 | } else { | 511 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 352 | } | 513 | 352 | } | 514 | 352 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 352 | return true; | 549 | 352 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ES2_Lb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 479 | 96 | CastParameters& params) { | 480 | 96 | MaxNativeType res; | 481 | 96 | if (from >= FromCppT(0)) { | 482 | 96 | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | 96 | } else { | 495 | 96 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | 96 | if (UNLIKELY(res > max_result)) { | 497 | 40 | if (params.is_strict) { | 498 | 20 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | 20 | decimal_to_string(from.value, scale_from), | 500 | 20 | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | 20 | precision_to, scale_to); | 502 | 20 | } | 503 | 40 | return false; | 504 | 40 | } | 505 | 96 | } | 506 | 56 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 96 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | 0 | } else { | 528 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | 0 | if (UNLIKELY(res < -max_result)) { | 530 | 0 | if (params.is_strict) { | 531 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | 0 | decimal_to_string(from.value, scale_from), | 533 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | 0 | precision_to, scale_to); | 535 | 0 | } | 536 | 0 | return false; | 537 | 0 | } | 538 | 0 | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 288 | CastParameters& params) { | 480 | 288 | MaxNativeType res; | 481 | 288 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 288 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 288 | } else { | 511 | 288 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 288 | } | 513 | 288 | } | 514 | 288 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 288 | return true; | 549 | 288 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 479 | 350 | CastParameters& params) { | 480 | 350 | MaxNativeType res; | 481 | 350 | if (from >= FromCppT(0)) { | 482 | 350 | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | 350 | } else { | 495 | 350 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | 350 | if (UNLIKELY(res > max_result)) { | 497 | 132 | if (params.is_strict) { | 498 | 66 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | 66 | decimal_to_string(from.value, scale_from), | 500 | 66 | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | 66 | precision_to, scale_to); | 502 | 66 | } | 503 | 132 | return false; | 504 | 132 | } | 505 | 350 | } | 506 | 218 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 350 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | 0 | } else { | 528 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | 0 | if (UNLIKELY(res < -max_result)) { | 530 | 0 | if (params.is_strict) { | 531 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | 0 | decimal_to_string(from.value, scale_from), | 533 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | 0 | precision_to, scale_to); | 535 | 0 | } | 536 | 0 | return false; | 537 | 0 | } | 538 | 0 | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 184 | CastParameters& params) { | 480 | 184 | MaxNativeType res; | 481 | 184 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 184 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 184 | } else { | 511 | 184 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 184 | } | 513 | 184 | } | 514 | 184 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 184 | return true; | 549 | 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 | 479 | 352 | CastParameters& params) { | 480 | 352 | MaxNativeType res; | 481 | 352 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 352 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 352 | } else { | 511 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 352 | } | 513 | 352 | } | 514 | 352 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 352 | return true; | 549 | 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 | 479 | 352 | CastParameters& params) { | 480 | 352 | MaxNativeType res; | 481 | 352 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 352 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 352 | } else { | 511 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 352 | } | 513 | 352 | } | 514 | 352 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 352 | return true; | 549 | 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 | 479 | 352 | CastParameters& params) { | 480 | 352 | MaxNativeType res; | 481 | 352 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 352 | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | 352 | } else { | 511 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | 352 | } | 513 | 352 | } | 514 | 352 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | 0 | } else { | 544 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | 0 | } | 546 | 0 | } | 547 | 0 | } | 548 | 352 | return true; | 549 | 352 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 479 | 96 | CastParameters& params) { | 480 | 96 | MaxNativeType res; | 481 | 96 | if (from >= FromCppT(0)) { | 482 | 96 | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | 96 | } else { | 495 | 96 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | 96 | if (UNLIKELY(res > max_result)) { | 497 | 40 | if (params.is_strict) { | 498 | 20 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | 20 | decimal_to_string(from.value, scale_from), | 500 | 20 | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | 20 | precision_to, scale_to); | 502 | 20 | } | 503 | 40 | return false; | 504 | 40 | } | 505 | 96 | } | 506 | 56 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 96 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | 0 | } else { | 528 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | 0 | if (UNLIKELY(res < -max_result)) { | 530 | 0 | if (params.is_strict) { | 531 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | 0 | decimal_to_string(from.value, scale_from), | 533 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | 0 | precision_to, scale_to); | 535 | 0 | } | 536 | 0 | return false; | 537 | 0 | } | 538 | 0 | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 32 | CastParameters& params) { | 480 | 32 | MaxNativeType res; | 481 | 32 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 32 | } else { | 508 | 32 | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | 32 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | 32 | } | 514 | 32 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | 0 | } | 547 | 0 | } | 548 | 32 | return true; | 549 | 32 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 479 | 435 | CastParameters& params) { | 480 | 435 | MaxNativeType res; | 481 | 435 | if (from >= FromCppT(0)) { | 482 | 435 | if constexpr (narrow_integral) { | 483 | 435 | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | 435 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | 435 | if (UNLIKELY(res > max_result)) { | 486 | 156 | if (params.is_strict) { | 487 | 78 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | 78 | decimal_to_string(from.value(), scale_from), | 489 | 78 | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | 78 | precision_to, scale_to); | 491 | 78 | } | 492 | 156 | return false; | 493 | 156 | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | 279 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 435 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | 0 | if (UNLIKELY(res < -max_result)) { | 519 | 0 | if (params.is_strict) { | 520 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | 0 | decimal_to_string(from.value(), scale_from), | 522 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | 0 | precision_to, scale_to); | 524 | 0 | } | 525 | 0 | return false; | 526 | 0 | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 124 | CastParameters& params) { | 480 | 124 | MaxNativeType res; | 481 | 124 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 124 | } else { | 508 | 124 | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | 124 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | 124 | } | 514 | 124 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | 0 | } | 547 | 0 | } | 548 | 124 | return true; | 549 | 124 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 479 | 354 | CastParameters& params) { | 480 | 354 | MaxNativeType res; | 481 | 354 | if (from >= FromCppT(0)) { | 482 | 354 | if constexpr (narrow_integral) { | 483 | 354 | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | 354 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | 354 | if (UNLIKELY(res > max_result)) { | 486 | 84 | if (params.is_strict) { | 487 | 42 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | 42 | decimal_to_string(from.value(), scale_from), | 489 | 42 | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | 42 | precision_to, scale_to); | 491 | 42 | } | 492 | 84 | return false; | 493 | 84 | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | 270 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 354 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | 0 | if (UNLIKELY(res < -max_result)) { | 519 | 0 | if (params.is_strict) { | 520 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | 0 | decimal_to_string(from.value(), scale_from), | 522 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | 0 | precision_to, scale_to); | 524 | 0 | } | 525 | 0 | return false; | 526 | 0 | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 364 | CastParameters& params) { | 480 | 364 | MaxNativeType res; | 481 | 364 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 364 | } else { | 508 | 364 | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | 364 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | 364 | } | 514 | 364 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | 0 | } | 547 | 0 | } | 548 | 364 | return true; | 549 | 364 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 479 | 50 | CastParameters& params) { | 480 | 50 | MaxNativeType res; | 481 | 50 | if (from >= FromCppT(0)) { | 482 | 50 | if constexpr (narrow_integral) { | 483 | 50 | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | 50 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | 50 | if (UNLIKELY(res > max_result)) { | 486 | 4 | if (params.is_strict) { | 487 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | 2 | decimal_to_string(from.value(), scale_from), | 489 | 2 | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | 2 | precision_to, scale_to); | 491 | 2 | } | 492 | 4 | return false; | 493 | 4 | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | 46 | to = ToCppT(res); | 507 | | } else { | 508 | | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | | } | 514 | 50 | } else { | 515 | 0 | if constexpr (narrow_integral) { | 516 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | 0 | if (UNLIKELY(res < -max_result)) { | 519 | 0 | if (params.is_strict) { | 520 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | 0 | decimal_to_string(from.value(), scale_from), | 522 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | 0 | precision_to, scale_to); | 524 | 0 | } | 525 | 0 | return false; | 526 | 0 | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | 0 | to = ToCppT(res); | 540 | | } else { | 541 | | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | | } | 547 | 0 | } | 548 | 0 | return true; | 549 | 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 | 479 | 412 | CastParameters& params) { | 480 | 412 | MaxNativeType res; | 481 | 412 | if (from >= FromCppT(0)) { | 482 | | if constexpr (narrow_integral) { | 483 | | if constexpr (IsDecimal128V2<FromCppT>) { | 484 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 485 | | if (UNLIKELY(res > max_result)) { | 486 | | if (params.is_strict) { | 487 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 488 | | decimal_to_string(from.value(), scale_from), | 489 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 490 | | precision_to, scale_to); | 491 | | } | 492 | | return false; | 493 | | } | 494 | | } else { | 495 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 496 | | if (UNLIKELY(res > max_result)) { | 497 | | if (params.is_strict) { | 498 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 499 | | decimal_to_string(from.value, scale_from), | 500 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 501 | | precision_to, scale_to); | 502 | | } | 503 | | return false; | 504 | | } | 505 | | } | 506 | | to = ToCppT(res); | 507 | 412 | } else { | 508 | 412 | if constexpr (IsDecimal128V2<FromCppT>) { | 509 | 412 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 510 | | } else { | 511 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 512 | | } | 513 | 412 | } | 514 | 412 | } else { | 515 | | if constexpr (narrow_integral) { | 516 | | if constexpr (IsDecimal128V2<FromCppT>) { | 517 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 518 | | if (UNLIKELY(res < -max_result)) { | 519 | | if (params.is_strict) { | 520 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 521 | | decimal_to_string(from.value(), scale_from), | 522 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 523 | | precision_to, scale_to); | 524 | | } | 525 | | return false; | 526 | | } | 527 | | } else { | 528 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 529 | | if (UNLIKELY(res < -max_result)) { | 530 | | if (params.is_strict) { | 531 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 532 | | decimal_to_string(from.value, scale_from), | 533 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 534 | | precision_to, scale_to); | 535 | | } | 536 | | return false; | 537 | | } | 538 | | } | 539 | | to = ToCppT(res); | 540 | 0 | } else { | 541 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 542 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 543 | | } else { | 544 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 545 | | } | 546 | 0 | } | 547 | 0 | } | 548 | 412 | return true; | 549 | 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 |
550 | | |
551 | | template <typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
552 | | typename MaxNativeType = |
553 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
554 | | FromCppT, typename ToCppT::NativeType>> |
555 | | requires(IsDecimalNumber<ToCppT> && !IsDecimal128V2<ToCppT> && |
556 | | (IsCppTypeInt<FromCppT> || std::is_same_v<FromCppT, UInt8>)) |
557 | | static inline bool _from_int(const FromCppT& from, ToCppT& to, UInt32 precision, UInt32 scale, |
558 | | const MaxNativeType& scale_multiplier, |
559 | | const typename ToCppT::NativeType& min_result, |
560 | | const typename ToCppT::NativeType& max_result, |
561 | 3.33k | CastParameters& params) { |
562 | 3.33k | MaxNativeType tmp; |
563 | 3.33k | if constexpr (multiply_may_overflow) { |
564 | 1.05k | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { |
565 | 154 | if (params.is_strict) { |
566 | 76 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, |
567 | 76 | precision, scale); |
568 | 76 | } |
569 | 154 | return false; |
570 | 154 | } |
571 | 901 | if constexpr (narrow_integral) { |
572 | 901 | if (tmp < min_result || tmp > max_result) { |
573 | 177 | if (params.is_strict) { |
574 | 88 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
575 | 88 | from, int_type_name<FromCppT>, precision, scale); |
576 | 88 | } |
577 | 177 | return false; |
578 | 177 | } |
579 | 901 | } |
580 | 724 | to.value = static_cast<typename ToCppT::NativeType>(tmp); |
581 | 2.28k | } else { |
582 | 2.28k | tmp = scale_multiplier * from; |
583 | 2.28k | if constexpr (narrow_integral) { |
584 | 1.42k | if (tmp < min_result || tmp > max_result) { |
585 | 433 | if (params.is_strict) { |
586 | 216 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
587 | 216 | from, int_type_name<FromCppT>, precision, scale); |
588 | 216 | } |
589 | 433 | return false; |
590 | 433 | } |
591 | 1.42k | } |
592 | 988 | to.value = static_cast<typename ToCppT::NativeType>(tmp); |
593 | 2.28k | } |
594 | | |
595 | 0 | return true; |
596 | 3.33k | } _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 561 | 10 | CastParameters& params) { | 562 | 10 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 10 | } else { | 582 | 10 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 10 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 10 | } | 594 | | | 595 | 10 | return true; | 596 | 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 | 561 | 4 | CastParameters& params) { | 562 | 4 | MaxNativeType tmp; | 563 | 4 | if constexpr (multiply_may_overflow) { | 564 | 4 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 0 | if (params.is_strict) { | 566 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 0 | precision, scale); | 568 | 0 | } | 569 | 0 | return false; | 570 | 0 | } | 571 | 4 | if constexpr (narrow_integral) { | 572 | 4 | if (tmp < min_result || tmp > max_result) { | 573 | 2 | if (params.is_strict) { | 574 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 1 | from, int_type_name<FromCppT>, precision, scale); | 576 | 1 | } | 577 | 2 | return false; | 578 | 2 | } | 579 | 4 | } | 580 | 2 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 561 | 55 | CastParameters& params) { | 562 | 55 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 55 | } else { | 582 | 55 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 55 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 55 | } | 594 | | | 595 | 55 | return true; | 596 | 55 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIiEELb0ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 561 | 74 | CastParameters& params) { | 562 | 74 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 74 | } else { | 582 | 74 | tmp = scale_multiplier * from; | 583 | 74 | if constexpr (narrow_integral) { | 584 | 74 | if (tmp < min_result || tmp > max_result) { | 585 | 24 | if (params.is_strict) { | 586 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 12 | from, int_type_name<FromCppT>, precision, scale); | 588 | 12 | } | 589 | 24 | return false; | 590 | 24 | } | 591 | 74 | } | 592 | 50 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 74 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 22 | CastParameters& params) { | 562 | 22 | MaxNativeType tmp; | 563 | 22 | if constexpr (multiply_may_overflow) { | 564 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 18 | if constexpr (narrow_integral) { | 572 | 18 | if (tmp < min_result || tmp > max_result) { | 573 | 4 | if (params.is_strict) { | 574 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 2 | from, int_type_name<FromCppT>, precision, scale); | 576 | 2 | } | 577 | 4 | return false; | 578 | 4 | } | 579 | 18 | } | 580 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 561 | 36 | CastParameters& params) { | 562 | 36 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 36 | } else { | 582 | 36 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 36 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 36 | } | 594 | | | 595 | 36 | return true; | 596 | 36 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIiEELb0ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 561 | 109 | CastParameters& params) { | 562 | 109 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 109 | } else { | 582 | 109 | tmp = scale_multiplier * from; | 583 | 109 | if constexpr (narrow_integral) { | 584 | 109 | if (tmp < min_result || tmp > max_result) { | 585 | 33 | if (params.is_strict) { | 586 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 16 | from, int_type_name<FromCppT>, precision, scale); | 588 | 16 | } | 589 | 33 | return false; | 590 | 33 | } | 591 | 109 | } | 592 | 76 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 109 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 22 | CastParameters& params) { | 562 | 22 | MaxNativeType tmp; | 563 | 22 | if constexpr (multiply_may_overflow) { | 564 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 18 | if constexpr (narrow_integral) { | 572 | 18 | if (tmp < min_result || tmp > max_result) { | 573 | 4 | if (params.is_strict) { | 574 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 2 | from, int_type_name<FromCppT>, precision, scale); | 576 | 2 | } | 577 | 4 | return false; | 578 | 4 | } | 579 | 18 | } | 580 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 90 | CastParameters& params) { | 562 | 90 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 90 | } else { | 582 | 90 | tmp = scale_multiplier * from; | 583 | 90 | if constexpr (narrow_integral) { | 584 | 90 | if (tmp < min_result || tmp > max_result) { | 585 | 24 | if (params.is_strict) { | 586 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 12 | from, int_type_name<FromCppT>, precision, scale); | 588 | 12 | } | 589 | 24 | return false; | 590 | 24 | } | 591 | 90 | } | 592 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 90 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 109 | CastParameters& params) { | 562 | 109 | MaxNativeType tmp; | 563 | 109 | if constexpr (multiply_may_overflow) { | 564 | 109 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 17 | if (params.is_strict) { | 566 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 8 | precision, scale); | 568 | 8 | } | 569 | 17 | return false; | 570 | 17 | } | 571 | 92 | if constexpr (narrow_integral) { | 572 | 92 | if (tmp < min_result || tmp > max_result) { | 573 | 16 | if (params.is_strict) { | 574 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 8 | from, int_type_name<FromCppT>, precision, scale); | 576 | 8 | } | 577 | 16 | return false; | 578 | 16 | } | 579 | 92 | } | 580 | 76 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 90 | CastParameters& params) { | 562 | 90 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 90 | } else { | 582 | 90 | tmp = scale_multiplier * from; | 583 | 90 | if constexpr (narrow_integral) { | 584 | 90 | if (tmp < min_result || tmp > max_result) { | 585 | 24 | if (params.is_strict) { | 586 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 12 | from, int_type_name<FromCppT>, precision, scale); | 588 | 12 | } | 589 | 24 | return false; | 590 | 24 | } | 591 | 90 | } | 592 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 90 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 109 | CastParameters& params) { | 562 | 109 | MaxNativeType tmp; | 563 | 109 | if constexpr (multiply_may_overflow) { | 564 | 109 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 17 | if (params.is_strict) { | 566 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 8 | precision, scale); | 568 | 8 | } | 569 | 17 | return false; | 570 | 17 | } | 571 | 92 | if constexpr (narrow_integral) { | 572 | 92 | if (tmp < min_result || tmp > max_result) { | 573 | 16 | if (params.is_strict) { | 574 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 8 | from, int_type_name<FromCppT>, precision, scale); | 576 | 8 | } | 577 | 16 | return false; | 578 | 16 | } | 579 | 92 | } | 580 | 76 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 90 | CastParameters& params) { | 562 | 90 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 90 | } else { | 582 | 90 | tmp = scale_multiplier * from; | 583 | 90 | if constexpr (narrow_integral) { | 584 | 90 | if (tmp < min_result || tmp > max_result) { | 585 | 24 | if (params.is_strict) { | 586 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 12 | from, int_type_name<FromCppT>, precision, scale); | 588 | 12 | } | 589 | 24 | return false; | 590 | 24 | } | 591 | 90 | } | 592 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 90 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 109 | CastParameters& params) { | 562 | 109 | MaxNativeType tmp; | 563 | 109 | if constexpr (multiply_may_overflow) { | 564 | 109 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 16 | if (params.is_strict) { | 566 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 8 | precision, scale); | 568 | 8 | } | 569 | 16 | return false; | 570 | 16 | } | 571 | 93 | if constexpr (narrow_integral) { | 572 | 93 | if (tmp < min_result || tmp > max_result) { | 573 | 17 | if (params.is_strict) { | 574 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 8 | from, int_type_name<FromCppT>, precision, scale); | 576 | 8 | } | 577 | 17 | return false; | 578 | 17 | } | 579 | 93 | } | 580 | 76 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 109 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 561 | 8 | CastParameters& params) { | 562 | 8 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 8 | } else { | 582 | 8 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 8 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 8 | } | 594 | | | 595 | 8 | return true; | 596 | 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 | 561 | 4 | CastParameters& params) { | 562 | 4 | MaxNativeType tmp; | 563 | 4 | if constexpr (multiply_may_overflow) { | 564 | 4 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 0 | if (params.is_strict) { | 566 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 0 | precision, scale); | 568 | 0 | } | 569 | 0 | return false; | 570 | 0 | } | 571 | 4 | if constexpr (narrow_integral) { | 572 | 4 | if (tmp < min_result || tmp > max_result) { | 573 | 2 | if (params.is_strict) { | 574 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 1 | from, int_type_name<FromCppT>, precision, scale); | 576 | 1 | } | 577 | 2 | return false; | 578 | 2 | } | 579 | 4 | } | 580 | 2 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 561 | 72 | CastParameters& params) { | 562 | 72 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 72 | } else { | 582 | 72 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 72 | } | 594 | | | 595 | 72 | return true; | 596 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 561 | 44 | CastParameters& params) { | 562 | 44 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 44 | } else { | 582 | 44 | tmp = scale_multiplier * from; | 583 | 44 | if constexpr (narrow_integral) { | 584 | 44 | if (tmp < min_result || tmp > max_result) { | 585 | 16 | if (params.is_strict) { | 586 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 8 | from, int_type_name<FromCppT>, precision, scale); | 588 | 8 | } | 589 | 16 | return false; | 590 | 16 | } | 591 | 44 | } | 592 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 44 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 22 | CastParameters& params) { | 562 | 22 | MaxNativeType tmp; | 563 | 22 | if constexpr (multiply_may_overflow) { | 564 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 18 | if constexpr (narrow_integral) { | 572 | 18 | if (tmp < min_result || tmp > max_result) { | 573 | 4 | if (params.is_strict) { | 574 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 2 | from, int_type_name<FromCppT>, precision, scale); | 576 | 2 | } | 577 | 4 | return false; | 578 | 4 | } | 579 | 18 | } | 580 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 561 | 72 | CastParameters& params) { | 562 | 72 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 72 | } else { | 582 | 72 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 72 | } | 594 | | | 595 | 72 | return true; | 596 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 561 | 44 | CastParameters& params) { | 562 | 44 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 44 | } else { | 582 | 44 | tmp = scale_multiplier * from; | 583 | 44 | if constexpr (narrow_integral) { | 584 | 44 | if (tmp < min_result || tmp > max_result) { | 585 | 16 | if (params.is_strict) { | 586 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 8 | from, int_type_name<FromCppT>, precision, scale); | 588 | 8 | } | 589 | 16 | return false; | 590 | 16 | } | 591 | 44 | } | 592 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 44 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 22 | CastParameters& params) { | 562 | 22 | MaxNativeType tmp; | 563 | 22 | if constexpr (multiply_may_overflow) { | 564 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 18 | if constexpr (narrow_integral) { | 572 | 18 | if (tmp < min_result || tmp > max_result) { | 573 | 4 | if (params.is_strict) { | 574 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 2 | from, int_type_name<FromCppT>, precision, scale); | 576 | 2 | } | 577 | 4 | return false; | 578 | 4 | } | 579 | 18 | } | 580 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 561 | 18 | CastParameters& params) { | 562 | 18 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 18 | } else { | 582 | 18 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 18 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 18 | } | 594 | | | 595 | 18 | return true; | 596 | 18 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 561 | 112 | CastParameters& params) { | 562 | 112 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 112 | } else { | 582 | 112 | tmp = scale_multiplier * from; | 583 | 112 | if constexpr (narrow_integral) { | 584 | 112 | if (tmp < min_result || tmp > max_result) { | 585 | 32 | if (params.is_strict) { | 586 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 16 | from, int_type_name<FromCppT>, precision, scale); | 588 | 16 | } | 589 | 32 | return false; | 590 | 32 | } | 591 | 112 | } | 592 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 112 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 56 | CastParameters& params) { | 562 | 56 | MaxNativeType tmp; | 563 | 56 | if constexpr (multiply_may_overflow) { | 564 | 56 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 52 | if constexpr (narrow_integral) { | 572 | 52 | if (tmp < min_result || tmp > max_result) { | 573 | 12 | if (params.is_strict) { | 574 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 6 | from, int_type_name<FromCppT>, precision, scale); | 576 | 6 | } | 577 | 12 | return false; | 578 | 12 | } | 579 | 52 | } | 580 | 40 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 90 | CastParameters& params) { | 562 | 90 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 90 | } else { | 582 | 90 | tmp = scale_multiplier * from; | 583 | 90 | if constexpr (narrow_integral) { | 584 | 90 | if (tmp < min_result || tmp > max_result) { | 585 | 24 | if (params.is_strict) { | 586 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 12 | from, int_type_name<FromCppT>, precision, scale); | 588 | 12 | } | 589 | 24 | return false; | 590 | 24 | } | 591 | 90 | } | 592 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 90 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 112 | CastParameters& params) { | 562 | 112 | MaxNativeType tmp; | 563 | 112 | if constexpr (multiply_may_overflow) { | 564 | 112 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 16 | if (params.is_strict) { | 566 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 8 | precision, scale); | 568 | 8 | } | 569 | 16 | return false; | 570 | 16 | } | 571 | 96 | if constexpr (narrow_integral) { | 572 | 96 | if (tmp < min_result || tmp > max_result) { | 573 | 16 | if (params.is_strict) { | 574 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 8 | from, int_type_name<FromCppT>, precision, scale); | 576 | 8 | } | 577 | 16 | return false; | 578 | 16 | } | 579 | 96 | } | 580 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 90 | CastParameters& params) { | 562 | 90 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 90 | } else { | 582 | 90 | tmp = scale_multiplier * from; | 583 | 90 | if constexpr (narrow_integral) { | 584 | 90 | if (tmp < min_result || tmp > max_result) { | 585 | 24 | if (params.is_strict) { | 586 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 12 | from, int_type_name<FromCppT>, precision, scale); | 588 | 12 | } | 589 | 24 | return false; | 590 | 24 | } | 591 | 90 | } | 592 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 90 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 112 | CastParameters& params) { | 562 | 112 | MaxNativeType tmp; | 563 | 112 | if constexpr (multiply_may_overflow) { | 564 | 112 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 16 | if (params.is_strict) { | 566 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 8 | precision, scale); | 568 | 8 | } | 569 | 16 | return false; | 570 | 16 | } | 571 | 96 | if constexpr (narrow_integral) { | 572 | 96 | if (tmp < min_result || tmp > max_result) { | 573 | 16 | if (params.is_strict) { | 574 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 8 | from, int_type_name<FromCppT>, precision, scale); | 576 | 8 | } | 577 | 16 | return false; | 578 | 16 | } | 579 | 96 | } | 580 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 112 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 561 | 8 | CastParameters& params) { | 562 | 8 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 8 | } else { | 582 | 8 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 8 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 8 | } | 594 | | | 595 | 8 | return true; | 596 | 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 | 561 | 4 | CastParameters& params) { | 562 | 4 | MaxNativeType tmp; | 563 | 4 | if constexpr (multiply_may_overflow) { | 564 | 4 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 0 | if (params.is_strict) { | 566 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 0 | precision, scale); | 568 | 0 | } | 569 | 0 | return false; | 570 | 0 | } | 571 | 4 | if constexpr (narrow_integral) { | 572 | 4 | if (tmp < min_result || tmp > max_result) { | 573 | 2 | if (params.is_strict) { | 574 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 1 | from, int_type_name<FromCppT>, precision, scale); | 576 | 1 | } | 577 | 2 | return false; | 578 | 2 | } | 579 | 4 | } | 580 | 2 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 561 | 72 | CastParameters& params) { | 562 | 72 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 72 | } else { | 582 | 72 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 72 | } | 594 | | | 595 | 72 | return true; | 596 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 561 | 44 | CastParameters& params) { | 562 | 44 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 44 | } else { | 582 | 44 | tmp = scale_multiplier * from; | 583 | 44 | if constexpr (narrow_integral) { | 584 | 44 | if (tmp < min_result || tmp > max_result) { | 585 | 16 | if (params.is_strict) { | 586 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 8 | from, int_type_name<FromCppT>, precision, scale); | 588 | 8 | } | 589 | 16 | return false; | 590 | 16 | } | 591 | 44 | } | 592 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 44 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 22 | CastParameters& params) { | 562 | 22 | MaxNativeType tmp; | 563 | 22 | if constexpr (multiply_may_overflow) { | 564 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 18 | if constexpr (narrow_integral) { | 572 | 18 | if (tmp < min_result || tmp > max_result) { | 573 | 4 | if (params.is_strict) { | 574 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 2 | from, int_type_name<FromCppT>, precision, scale); | 576 | 2 | } | 577 | 4 | return false; | 578 | 4 | } | 579 | 18 | } | 580 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 561 | 72 | CastParameters& params) { | 562 | 72 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 72 | } else { | 582 | 72 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 72 | } | 594 | | | 595 | 72 | return true; | 596 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 561 | 44 | CastParameters& params) { | 562 | 44 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 44 | } else { | 582 | 44 | tmp = scale_multiplier * from; | 583 | 44 | if constexpr (narrow_integral) { | 584 | 44 | if (tmp < min_result || tmp > max_result) { | 585 | 16 | if (params.is_strict) { | 586 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 8 | from, int_type_name<FromCppT>, precision, scale); | 588 | 8 | } | 589 | 16 | return false; | 590 | 16 | } | 591 | 44 | } | 592 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 44 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 22 | CastParameters& params) { | 562 | 22 | MaxNativeType tmp; | 563 | 22 | if constexpr (multiply_may_overflow) { | 564 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 18 | if constexpr (narrow_integral) { | 572 | 18 | if (tmp < min_result || tmp > max_result) { | 573 | 4 | if (params.is_strict) { | 574 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 2 | from, int_type_name<FromCppT>, precision, scale); | 576 | 2 | } | 577 | 4 | return false; | 578 | 4 | } | 579 | 18 | } | 580 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 561 | 72 | CastParameters& params) { | 562 | 72 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 72 | } else { | 582 | 72 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 72 | } | 594 | | | 595 | 72 | return true; | 596 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 561 | 44 | CastParameters& params) { | 562 | 44 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 44 | } else { | 582 | 44 | tmp = scale_multiplier * from; | 583 | 44 | if constexpr (narrow_integral) { | 584 | 44 | if (tmp < min_result || tmp > max_result) { | 585 | 16 | if (params.is_strict) { | 586 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 8 | from, int_type_name<FromCppT>, precision, scale); | 588 | 8 | } | 589 | 16 | return false; | 590 | 16 | } | 591 | 44 | } | 592 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 44 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 22 | CastParameters& params) { | 562 | 22 | MaxNativeType tmp; | 563 | 22 | if constexpr (multiply_may_overflow) { | 564 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 18 | if constexpr (narrow_integral) { | 572 | 18 | if (tmp < min_result || tmp > max_result) { | 573 | 4 | if (params.is_strict) { | 574 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 2 | from, int_type_name<FromCppT>, precision, scale); | 576 | 2 | } | 577 | 4 | return false; | 578 | 4 | } | 579 | 18 | } | 580 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 561 | 54 | CastParameters& params) { | 562 | 54 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 54 | } else { | 582 | 54 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 54 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 54 | } | 594 | | | 595 | 54 | return true; | 596 | 54 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 561 | 78 | CastParameters& params) { | 562 | 78 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 78 | } else { | 582 | 78 | tmp = scale_multiplier * from; | 583 | 78 | if constexpr (narrow_integral) { | 584 | 78 | if (tmp < min_result || tmp > max_result) { | 585 | 24 | if (params.is_strict) { | 586 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 12 | from, int_type_name<FromCppT>, precision, scale); | 588 | 12 | } | 589 | 24 | return false; | 590 | 24 | } | 591 | 78 | } | 592 | 54 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 78 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 22 | CastParameters& params) { | 562 | 22 | MaxNativeType tmp; | 563 | 22 | if constexpr (multiply_may_overflow) { | 564 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 18 | if constexpr (narrow_integral) { | 572 | 18 | if (tmp < min_result || tmp > max_result) { | 573 | 4 | if (params.is_strict) { | 574 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 2 | from, int_type_name<FromCppT>, precision, scale); | 576 | 2 | } | 577 | 4 | return false; | 578 | 4 | } | 579 | 18 | } | 580 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 90 | CastParameters& params) { | 562 | 90 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 90 | } else { | 582 | 90 | tmp = scale_multiplier * from; | 583 | 90 | if constexpr (narrow_integral) { | 584 | 90 | if (tmp < min_result || tmp > max_result) { | 585 | 24 | if (params.is_strict) { | 586 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 12 | from, int_type_name<FromCppT>, precision, scale); | 588 | 12 | } | 589 | 24 | return false; | 590 | 24 | } | 591 | 90 | } | 592 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 90 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 112 | CastParameters& params) { | 562 | 112 | MaxNativeType tmp; | 563 | 112 | if constexpr (multiply_may_overflow) { | 564 | 112 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 16 | if (params.is_strict) { | 566 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 8 | precision, scale); | 568 | 8 | } | 569 | 16 | return false; | 570 | 16 | } | 571 | 96 | if constexpr (narrow_integral) { | 572 | 96 | if (tmp < min_result || tmp > max_result) { | 573 | 16 | if (params.is_strict) { | 574 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 8 | from, int_type_name<FromCppT>, precision, scale); | 576 | 8 | } | 577 | 16 | return false; | 578 | 16 | } | 579 | 96 | } | 580 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 112 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 561 | 8 | CastParameters& params) { | 562 | 8 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 8 | } else { | 582 | 8 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 8 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 8 | } | 594 | | | 595 | 8 | return true; | 596 | 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 | 561 | 4 | CastParameters& params) { | 562 | 4 | MaxNativeType tmp; | 563 | 4 | if constexpr (multiply_may_overflow) { | 564 | 4 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 0 | if (params.is_strict) { | 566 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 0 | precision, scale); | 568 | 0 | } | 569 | 0 | return false; | 570 | 0 | } | 571 | 4 | if constexpr (narrow_integral) { | 572 | 4 | if (tmp < min_result || tmp > max_result) { | 573 | 2 | if (params.is_strict) { | 574 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 1 | from, int_type_name<FromCppT>, precision, scale); | 576 | 1 | } | 577 | 2 | return false; | 578 | 2 | } | 579 | 4 | } | 580 | 2 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 561 | 72 | CastParameters& params) { | 562 | 72 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 72 | } else { | 582 | 72 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 72 | } | 594 | | | 595 | 72 | return true; | 596 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 561 | 44 | CastParameters& params) { | 562 | 44 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 44 | } else { | 582 | 44 | tmp = scale_multiplier * from; | 583 | 44 | if constexpr (narrow_integral) { | 584 | 44 | if (tmp < min_result || tmp > max_result) { | 585 | 16 | if (params.is_strict) { | 586 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 8 | from, int_type_name<FromCppT>, precision, scale); | 588 | 8 | } | 589 | 16 | return false; | 590 | 16 | } | 591 | 44 | } | 592 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 44 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 22 | CastParameters& params) { | 562 | 22 | MaxNativeType tmp; | 563 | 22 | if constexpr (multiply_may_overflow) { | 564 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 18 | if constexpr (narrow_integral) { | 572 | 18 | if (tmp < min_result || tmp > max_result) { | 573 | 4 | if (params.is_strict) { | 574 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 2 | from, int_type_name<FromCppT>, precision, scale); | 576 | 2 | } | 577 | 4 | return false; | 578 | 4 | } | 579 | 18 | } | 580 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 561 | 72 | CastParameters& params) { | 562 | 72 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 72 | } else { | 582 | 72 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 72 | } | 594 | | | 595 | 72 | return true; | 596 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 561 | 44 | CastParameters& params) { | 562 | 44 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 44 | } else { | 582 | 44 | tmp = scale_multiplier * from; | 583 | 44 | if constexpr (narrow_integral) { | 584 | 44 | if (tmp < min_result || tmp > max_result) { | 585 | 16 | if (params.is_strict) { | 586 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 8 | from, int_type_name<FromCppT>, precision, scale); | 588 | 8 | } | 589 | 16 | return false; | 590 | 16 | } | 591 | 44 | } | 592 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 44 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 22 | CastParameters& params) { | 562 | 22 | MaxNativeType tmp; | 563 | 22 | if constexpr (multiply_may_overflow) { | 564 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 18 | if constexpr (narrow_integral) { | 572 | 18 | if (tmp < min_result || tmp > max_result) { | 573 | 4 | if (params.is_strict) { | 574 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 2 | from, int_type_name<FromCppT>, precision, scale); | 576 | 2 | } | 577 | 4 | return false; | 578 | 4 | } | 579 | 18 | } | 580 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 561 | 72 | CastParameters& params) { | 562 | 72 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 72 | } else { | 582 | 72 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 72 | } | 594 | | | 595 | 72 | return true; | 596 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 561 | 44 | CastParameters& params) { | 562 | 44 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 44 | } else { | 582 | 44 | tmp = scale_multiplier * from; | 583 | 44 | if constexpr (narrow_integral) { | 584 | 44 | if (tmp < min_result || tmp > max_result) { | 585 | 16 | if (params.is_strict) { | 586 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 8 | from, int_type_name<FromCppT>, precision, scale); | 588 | 8 | } | 589 | 16 | return false; | 590 | 16 | } | 591 | 44 | } | 592 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 44 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 22 | CastParameters& params) { | 562 | 22 | MaxNativeType tmp; | 563 | 22 | if constexpr (multiply_may_overflow) { | 564 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 18 | if constexpr (narrow_integral) { | 572 | 18 | if (tmp < min_result || tmp > max_result) { | 573 | 4 | if (params.is_strict) { | 574 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 2 | from, int_type_name<FromCppT>, precision, scale); | 576 | 2 | } | 577 | 4 | return false; | 578 | 4 | } | 579 | 18 | } | 580 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 561 | 72 | CastParameters& params) { | 562 | 72 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 72 | } else { | 582 | 72 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 72 | } | 594 | | | 595 | 72 | return true; | 596 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 561 | 44 | CastParameters& params) { | 562 | 44 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 44 | } else { | 582 | 44 | tmp = scale_multiplier * from; | 583 | 44 | if constexpr (narrow_integral) { | 584 | 44 | if (tmp < min_result || tmp > max_result) { | 585 | 16 | if (params.is_strict) { | 586 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 8 | from, int_type_name<FromCppT>, precision, scale); | 588 | 8 | } | 589 | 16 | return false; | 590 | 16 | } | 591 | 44 | } | 592 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 44 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 22 | CastParameters& params) { | 562 | 22 | MaxNativeType tmp; | 563 | 22 | if constexpr (multiply_may_overflow) { | 564 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 18 | if constexpr (narrow_integral) { | 572 | 18 | if (tmp < min_result || tmp > max_result) { | 573 | 4 | if (params.is_strict) { | 574 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 2 | from, int_type_name<FromCppT>, precision, scale); | 576 | 2 | } | 577 | 4 | return false; | 578 | 4 | } | 579 | 18 | } | 580 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 22 | } |
_ZN5doris13CastToDecimal9_from_intInNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 561 | 18 | CastParameters& params) { | 562 | 18 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 18 | } else { | 582 | 18 | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | 18 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 18 | } | 594 | | | 595 | 18 | return true; | 596 | 18 | } |
_ZN5doris13CastToDecimal9_from_intInNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 561 | 112 | CastParameters& params) { | 562 | 112 | MaxNativeType tmp; | 563 | | if constexpr (multiply_may_overflow) { | 564 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | | if (params.is_strict) { | 566 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | | precision, scale); | 568 | | } | 569 | | return false; | 570 | | } | 571 | | if constexpr (narrow_integral) { | 572 | | if (tmp < min_result || tmp > max_result) { | 573 | | if (params.is_strict) { | 574 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | | from, int_type_name<FromCppT>, precision, scale); | 576 | | } | 577 | | return false; | 578 | | } | 579 | | } | 580 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | 112 | } else { | 582 | 112 | tmp = scale_multiplier * from; | 583 | 112 | if constexpr (narrow_integral) { | 584 | 112 | if (tmp < min_result || tmp > max_result) { | 585 | 32 | if (params.is_strict) { | 586 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | 16 | from, int_type_name<FromCppT>, precision, scale); | 588 | 16 | } | 589 | 32 | return false; | 590 | 32 | } | 591 | 112 | } | 592 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | 112 | } | 594 | | | 595 | 0 | return true; | 596 | 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 | 561 | 56 | CastParameters& params) { | 562 | 56 | MaxNativeType tmp; | 563 | 56 | if constexpr (multiply_may_overflow) { | 564 | 56 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 565 | 4 | if (params.is_strict) { | 566 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 567 | 2 | precision, scale); | 568 | 2 | } | 569 | 4 | return false; | 570 | 4 | } | 571 | 52 | if constexpr (narrow_integral) { | 572 | 52 | if (tmp < min_result || tmp > max_result) { | 573 | 12 | if (params.is_strict) { | 574 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 575 | 6 | from, int_type_name<FromCppT>, precision, scale); | 576 | 6 | } | 577 | 12 | return false; | 578 | 12 | } | 579 | 52 | } | 580 | 40 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 581 | | } else { | 582 | | tmp = scale_multiplier * from; | 583 | | if constexpr (narrow_integral) { | 584 | | if (tmp < min_result || tmp > max_result) { | 585 | | if (params.is_strict) { | 586 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 587 | | from, int_type_name<FromCppT>, precision, scale); | 588 | | } | 589 | | return false; | 590 | | } | 591 | | } | 592 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 593 | | } | 594 | | | 595 | 0 | return true; | 596 | 56 | } |
|
597 | | |
598 | | template <typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
599 | | typename MaxNativeType = |
600 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
601 | | FromCppT, typename ToCppT::NativeType>> |
602 | | requires(IsDecimalV2<ToCppT> && (IsCppTypeInt<FromCppT> || std::is_same_v<FromCppT, UInt8>)) |
603 | | static inline bool _from_int(const FromCppT& from, ToCppT& to, UInt32 precision, UInt32 scale, |
604 | | const MaxNativeType& scale_multiplier, |
605 | | const typename ToCppT::NativeType& min_result, |
606 | | const typename ToCppT::NativeType& max_result, |
607 | 6 | CastParameters& params) { |
608 | 6 | MaxNativeType tmp; |
609 | 6 | if constexpr (multiply_may_overflow) { |
610 | 0 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { |
611 | 0 | if (params.is_strict) { |
612 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, |
613 | 0 | precision, scale); |
614 | 0 | } |
615 | 0 | return false; |
616 | 0 | } |
617 | 0 | if constexpr (narrow_integral) { |
618 | 0 | if (tmp < min_result || tmp > max_result) { |
619 | 0 | if (params.is_strict) { |
620 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
621 | 0 | from, int_type_name<FromCppT>, precision, scale); |
622 | 0 | } |
623 | 0 | return false; |
624 | 0 | } |
625 | 0 | } |
626 | 0 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); |
627 | 6 | } else { |
628 | 6 | tmp = scale_multiplier * from; |
629 | 6 | if constexpr (narrow_integral) { |
630 | 4 | if (tmp < min_result || tmp > max_result) { |
631 | 2 | if (params.is_strict) { |
632 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
633 | 1 | from, int_type_name<FromCppT>, precision, scale); |
634 | 1 | } |
635 | 2 | return false; |
636 | 2 | } |
637 | 4 | } |
638 | 2 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); |
639 | 6 | } |
640 | | |
641 | 0 | return true; |
642 | 6 | } _ZN5doris13CastToDecimal9_from_intIhNS_14DecimalV2ValueELb0ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 607 | 2 | CastParameters& params) { | 608 | 2 | MaxNativeType tmp; | 609 | | if constexpr (multiply_may_overflow) { | 610 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 611 | | if (params.is_strict) { | 612 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 613 | | precision, scale); | 614 | | } | 615 | | return false; | 616 | | } | 617 | | if constexpr (narrow_integral) { | 618 | | if (tmp < min_result || tmp > max_result) { | 619 | | if (params.is_strict) { | 620 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 621 | | from, int_type_name<FromCppT>, precision, scale); | 622 | | } | 623 | | return false; | 624 | | } | 625 | | } | 626 | | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 627 | 2 | } else { | 628 | 2 | tmp = scale_multiplier * from; | 629 | | if constexpr (narrow_integral) { | 630 | | if (tmp < min_result || tmp > max_result) { | 631 | | if (params.is_strict) { | 632 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 633 | | from, int_type_name<FromCppT>, precision, scale); | 634 | | } | 635 | | return false; | 636 | | } | 637 | | } | 638 | 2 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 639 | 2 | } | 640 | | | 641 | 2 | return true; | 642 | 2 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_14DecimalV2ValueELb0ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 607 | 4 | CastParameters& params) { | 608 | 4 | MaxNativeType tmp; | 609 | | if constexpr (multiply_may_overflow) { | 610 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 611 | | if (params.is_strict) { | 612 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 613 | | precision, scale); | 614 | | } | 615 | | return false; | 616 | | } | 617 | | if constexpr (narrow_integral) { | 618 | | if (tmp < min_result || tmp > max_result) { | 619 | | if (params.is_strict) { | 620 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 621 | | from, int_type_name<FromCppT>, precision, scale); | 622 | | } | 623 | | return false; | 624 | | } | 625 | | } | 626 | | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 627 | 4 | } else { | 628 | 4 | tmp = scale_multiplier * from; | 629 | 4 | if constexpr (narrow_integral) { | 630 | 4 | if (tmp < min_result || tmp > max_result) { | 631 | 2 | if (params.is_strict) { | 632 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 633 | 1 | from, int_type_name<FromCppT>, precision, scale); | 634 | 1 | } | 635 | 2 | return false; | 636 | 2 | } | 637 | 4 | } | 638 | 2 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 639 | 4 | } | 640 | | | 641 | 0 | return true; | 642 | 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 |
643 | | }; |
644 | | |
645 | | // Casting from string to decimal types. |
646 | | template <CastModeType Mode, typename ToDataType> |
647 | | requires(IsDataTypeDecimal<ToDataType>) |
648 | | class CastToImpl<Mode, DataTypeString, ToDataType> : public CastToBase { |
649 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
650 | | uint32_t result, size_t input_rows_count, |
651 | 5.86k | const NullMap::value_type* null_map = nullptr) const override { |
652 | 5.86k | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( |
653 | 5.86k | block.get_by_position(arguments[0]).column.get()); |
654 | | |
655 | 5.86k | auto to_type = block.get_by_position(result).type; |
656 | 5.86k | auto serde = remove_nullable(to_type)->get_serde(); |
657 | | |
658 | | // by default framework, to_type is already unwrapped nullable |
659 | 5.86k | MutableColumnPtr column_to = to_type->create_column(); |
660 | 5.86k | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( |
661 | 5.86k | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); |
662 | | |
663 | 5.86k | if constexpr (Mode == CastModeType::NonStrictMode) { |
664 | | // may write nulls to nullable_col_to |
665 | 2.89k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); |
666 | 2.96k | } else if constexpr (Mode == CastModeType::StrictMode) { |
667 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows |
668 | 2.96k | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( |
669 | 2.96k | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); |
670 | | } else { |
671 | | return Status::InternalError("Unsupported cast mode"); |
672 | | } |
673 | | |
674 | 5.45k | block.get_by_position(result).column = std::move(nullable_col_to); |
675 | 5.86k | return Status::OK(); |
676 | 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 | 651 | 854 | const NullMap::value_type* null_map = nullptr) const override { | 652 | 854 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 653 | 854 | block.get_by_position(arguments[0]).column.get()); | 654 | | | 655 | 854 | auto to_type = block.get_by_position(result).type; | 656 | 854 | auto serde = remove_nullable(to_type)->get_serde(); | 657 | | | 658 | | // by default framework, to_type is already unwrapped nullable | 659 | 854 | MutableColumnPtr column_to = to_type->create_column(); | 660 | 854 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 661 | 854 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 662 | | | 663 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 664 | | // may write nulls to nullable_col_to | 665 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 666 | 854 | } else if constexpr (Mode == CastModeType::StrictMode) { | 667 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 668 | 854 | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 669 | 854 | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 670 | | } else { | 671 | | return Status::InternalError("Unsupported cast mode"); | 672 | | } | 673 | | | 674 | 665 | block.get_by_position(result).column = std::move(nullable_col_to); | 675 | 854 | return Status::OK(); | 676 | 854 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 651 | 782 | const NullMap::value_type* null_map = nullptr) const override { | 652 | 782 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 653 | 782 | block.get_by_position(arguments[0]).column.get()); | 654 | | | 655 | 782 | auto to_type = block.get_by_position(result).type; | 656 | 782 | auto serde = remove_nullable(to_type)->get_serde(); | 657 | | | 658 | | // by default framework, to_type is already unwrapped nullable | 659 | 782 | MutableColumnPtr column_to = to_type->create_column(); | 660 | 782 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 661 | 782 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 662 | | | 663 | 782 | if constexpr (Mode == CastModeType::NonStrictMode) { | 664 | | // may write nulls to nullable_col_to | 665 | 782 | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 666 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 667 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 668 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 669 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 670 | | } else { | 671 | | return Status::InternalError("Unsupported cast mode"); | 672 | | } | 673 | | | 674 | 782 | block.get_by_position(result).column = std::move(nullable_col_to); | 675 | 782 | return Status::OK(); | 676 | 782 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 651 | 709 | const NullMap::value_type* null_map = nullptr) const override { | 652 | 709 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 653 | 709 | block.get_by_position(arguments[0]).column.get()); | 654 | | | 655 | 709 | auto to_type = block.get_by_position(result).type; | 656 | 709 | auto serde = remove_nullable(to_type)->get_serde(); | 657 | | | 658 | | // by default framework, to_type is already unwrapped nullable | 659 | 709 | MutableColumnPtr column_to = to_type->create_column(); | 660 | 709 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 661 | 709 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 662 | | | 663 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 664 | | // may write nulls to nullable_col_to | 665 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 666 | 709 | } else if constexpr (Mode == CastModeType::StrictMode) { | 667 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 668 | 709 | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 669 | 709 | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 670 | | } else { | 671 | | return Status::InternalError("Unsupported cast mode"); | 672 | | } | 673 | | | 674 | 631 | block.get_by_position(result).column = std::move(nullable_col_to); | 675 | 709 | return Status::OK(); | 676 | 709 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 651 | 709 | const NullMap::value_type* null_map = nullptr) const override { | 652 | 709 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 653 | 709 | block.get_by_position(arguments[0]).column.get()); | 654 | | | 655 | 709 | auto to_type = block.get_by_position(result).type; | 656 | 709 | auto serde = remove_nullable(to_type)->get_serde(); | 657 | | | 658 | | // by default framework, to_type is already unwrapped nullable | 659 | 709 | MutableColumnPtr column_to = to_type->create_column(); | 660 | 709 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 661 | 709 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 662 | | | 663 | 709 | if constexpr (Mode == CastModeType::NonStrictMode) { | 664 | | // may write nulls to nullable_col_to | 665 | 709 | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 666 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 667 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 668 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 669 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 670 | | } else { | 671 | | return Status::InternalError("Unsupported cast mode"); | 672 | | } | 673 | | | 674 | 709 | block.get_by_position(result).column = std::move(nullable_col_to); | 675 | 709 | return Status::OK(); | 676 | 709 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 651 | 709 | const NullMap::value_type* null_map = nullptr) const override { | 652 | 709 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 653 | 709 | block.get_by_position(arguments[0]).column.get()); | 654 | | | 655 | 709 | auto to_type = block.get_by_position(result).type; | 656 | 709 | auto serde = remove_nullable(to_type)->get_serde(); | 657 | | | 658 | | // by default framework, to_type is already unwrapped nullable | 659 | 709 | MutableColumnPtr column_to = to_type->create_column(); | 660 | 709 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 661 | 709 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 662 | | | 663 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 664 | | // may write nulls to nullable_col_to | 665 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 666 | 709 | } else if constexpr (Mode == CastModeType::StrictMode) { | 667 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 668 | 709 | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 669 | 709 | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 670 | | } else { | 671 | | return Status::InternalError("Unsupported cast mode"); | 672 | | } | 673 | | | 674 | 631 | block.get_by_position(result).column = std::move(nullable_col_to); | 675 | 709 | return Status::OK(); | 676 | 709 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 651 | 709 | const NullMap::value_type* null_map = nullptr) const override { | 652 | 709 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 653 | 709 | block.get_by_position(arguments[0]).column.get()); | 654 | | | 655 | 709 | auto to_type = block.get_by_position(result).type; | 656 | 709 | auto serde = remove_nullable(to_type)->get_serde(); | 657 | | | 658 | | // by default framework, to_type is already unwrapped nullable | 659 | 709 | MutableColumnPtr column_to = to_type->create_column(); | 660 | 709 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 661 | 709 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 662 | | | 663 | 709 | if constexpr (Mode == CastModeType::NonStrictMode) { | 664 | | // may write nulls to nullable_col_to | 665 | 709 | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 666 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 667 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 668 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 669 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 670 | | } else { | 671 | | return Status::InternalError("Unsupported cast mode"); | 672 | | } | 673 | | | 674 | 709 | block.get_by_position(result).column = std::move(nullable_col_to); | 675 | 709 | return Status::OK(); | 676 | 709 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 651 | 695 | const NullMap::value_type* null_map = nullptr) const override { | 652 | 695 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 653 | 695 | block.get_by_position(arguments[0]).column.get()); | 654 | | | 655 | 695 | auto to_type = block.get_by_position(result).type; | 656 | 695 | auto serde = remove_nullable(to_type)->get_serde(); | 657 | | | 658 | | // by default framework, to_type is already unwrapped nullable | 659 | 695 | MutableColumnPtr column_to = to_type->create_column(); | 660 | 695 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 661 | 695 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 662 | | | 663 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 664 | | // may write nulls to nullable_col_to | 665 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 666 | 695 | } else if constexpr (Mode == CastModeType::StrictMode) { | 667 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 668 | 695 | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 669 | 695 | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 670 | | } else { | 671 | | return Status::InternalError("Unsupported cast mode"); | 672 | | } | 673 | | | 674 | 631 | block.get_by_position(result).column = std::move(nullable_col_to); | 675 | 695 | return Status::OK(); | 676 | 695 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 651 | 695 | const NullMap::value_type* null_map = nullptr) const override { | 652 | 695 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 653 | 695 | block.get_by_position(arguments[0]).column.get()); | 654 | | | 655 | 695 | auto to_type = block.get_by_position(result).type; | 656 | 695 | auto serde = remove_nullable(to_type)->get_serde(); | 657 | | | 658 | | // by default framework, to_type is already unwrapped nullable | 659 | 695 | MutableColumnPtr column_to = to_type->create_column(); | 660 | 695 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 661 | 695 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 662 | | | 663 | 695 | if constexpr (Mode == CastModeType::NonStrictMode) { | 664 | | // may write nulls to nullable_col_to | 665 | 695 | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 666 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 667 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 668 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 669 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 670 | | } else { | 671 | | return Status::InternalError("Unsupported cast mode"); | 672 | | } | 673 | | | 674 | 695 | block.get_by_position(result).column = std::move(nullable_col_to); | 675 | 695 | return Status::OK(); | 676 | 695 | } |
|
677 | | }; |
678 | | |
679 | | // cast bool and int to decimal. when may overflow, result column is nullable. |
680 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
681 | | requires(IsDataTypeDecimal<ToDataType> && |
682 | | (IsDataTypeInt<FromDataType> || IsDataTypeBool<FromDataType>)) |
683 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
684 | | public: |
685 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
686 | | uint32_t result, size_t input_rows_count, |
687 | 782 | const NullMap::value_type* null_map = nullptr) const override { |
688 | 782 | using FromFieldType = typename FromDataType::FieldType; |
689 | 782 | using ToFieldType = typename ToDataType::FieldType; |
690 | 782 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
691 | 782 | const auto* col_from = |
692 | 782 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
693 | 782 | if (!col_from) { |
694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
695 | 0 | named_from.column->get_name()); |
696 | 0 | } |
697 | | |
698 | 782 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); |
699 | 782 | constexpr UInt32 from_scale = 0; |
700 | | |
701 | 782 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
702 | 782 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
703 | 782 | UInt32 to_precision = to_decimal_type.get_precision(); |
704 | 782 | ToDataType::check_type_precision(to_precision); |
705 | 782 | UInt32 to_scale = to_decimal_type.get_scale(); |
706 | 782 | ToDataType::check_type_scale(to_scale); |
707 | | |
708 | 782 | auto from_max_int_digit_count = from_precision - from_scale; |
709 | 782 | auto to_max_int_digit_count = to_precision - to_scale; |
710 | | // may overflow. nullable result column. |
711 | 782 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); |
712 | | // only in non-strict mode and may overflow, we set nullable |
713 | 782 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
714 | | |
715 | 782 | constexpr UInt32 to_max_digits = |
716 | 782 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
717 | 782 | bool multiply_may_overflow = false; |
718 | 782 | if (to_scale > from_scale) { |
719 | 483 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
720 | 483 | } |
721 | 782 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > |
722 | 782 | sizeof(typename ToFieldType::NativeType)), |
723 | 782 | FromFieldType, typename ToFieldType::NativeType>; |
724 | 782 | MaxNativeType scale_multiplier = |
725 | 782 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); |
726 | 782 | typename ToFieldType::NativeType max_result = |
727 | 782 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
728 | 782 | typename ToFieldType::NativeType min_result = -max_result; |
729 | | |
730 | 782 | ColumnUInt8::MutablePtr col_null_map_to; |
731 | 782 | NullMap::value_type* null_map_data = nullptr; |
732 | 782 | if (narrow_integral) { |
733 | 673 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); |
734 | 673 | null_map_data = col_null_map_to->get_data().data(); |
735 | 673 | } |
736 | | |
737 | 782 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); |
738 | 782 | const auto& vec_from = col_from->get_data(); |
739 | 782 | const auto* vec_from_data = vec_from.data(); |
740 | 782 | auto& vec_to = col_to->get_data(); |
741 | 782 | auto* vec_to_data = vec_to.data(); |
742 | | |
743 | 782 | CastParameters params; |
744 | 782 | params.is_strict = (CastMode == CastModeType::StrictMode); |
745 | 782 | size_t size = vec_from.size(); |
746 | | |
747 | 782 | RETURN_IF_ERROR(std::visit( |
748 | 782 | [&](auto multiply_may_overflow, auto narrow_integral) { |
749 | 782 | for (size_t i = 0; i < size; i++) { |
750 | 782 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, |
751 | 782 | typename ToDataType::FieldType, |
752 | 782 | multiply_may_overflow, narrow_integral>( |
753 | 782 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, |
754 | 782 | scale_multiplier, min_result, max_result, params)) { |
755 | 782 | if (set_nullable) { |
756 | 782 | null_map_data[i] = 1; |
757 | 782 | } else { |
758 | 782 | return params.status; |
759 | 782 | } |
760 | 782 | } |
761 | 782 | } |
762 | 782 | return Status::OK(); |
763 | 782 | }, |
764 | 782 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
765 | | |
766 | 401 | if (narrow_integral) { |
767 | 292 | block.get_by_position(result).column = |
768 | 292 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
769 | 292 | } else { |
770 | 109 | block.get_by_position(result).column = std::move(col_to); |
771 | 109 | } |
772 | 401 | return Status::OK(); |
773 | 782 | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 2 | using FromFieldType = typename FromDataType::FieldType; | 689 | 2 | using ToFieldType = typename ToDataType::FieldType; | 690 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 2 | const auto* col_from = | 692 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 2 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 2 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 2 | ToDataType::check_type_precision(to_precision); | 705 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 2 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 2 | constexpr UInt32 to_max_digits = | 716 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 2 | bool multiply_may_overflow = false; | 718 | 2 | if (to_scale > from_scale) { | 719 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 2 | } | 721 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 2 | sizeof(typename ToFieldType::NativeType)), | 723 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 2 | MaxNativeType scale_multiplier = | 725 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 2 | typename ToFieldType::NativeType max_result = | 727 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 2 | NullMap::value_type* null_map_data = nullptr; | 732 | 2 | if (narrow_integral) { | 733 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 2 | null_map_data = col_null_map_to->get_data().data(); | 735 | 2 | } | 736 | | | 737 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 2 | const auto& vec_from = col_from->get_data(); | 739 | 2 | const auto* vec_from_data = vec_from.data(); | 740 | 2 | auto& vec_to = col_to->get_data(); | 741 | 2 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 2 | CastParameters params; | 744 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 2 | size_t size = vec_from.size(); | 746 | | | 747 | 2 | RETURN_IF_ERROR(std::visit( | 748 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 2 | for (size_t i = 0; i < size; i++) { | 750 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 2 | typename ToDataType::FieldType, | 752 | 2 | multiply_may_overflow, narrow_integral>( | 753 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 2 | scale_multiplier, min_result, max_result, params)) { | 755 | 2 | if (set_nullable) { | 756 | 2 | null_map_data[i] = 1; | 757 | 2 | } else { | 758 | 2 | return params.status; | 759 | 2 | } | 760 | 2 | } | 761 | 2 | } | 762 | 2 | return Status::OK(); | 763 | 2 | }, | 764 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 1 | if (narrow_integral) { | 767 | 1 | block.get_by_position(result).column = | 768 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 1 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 1 | return Status::OK(); | 773 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 2 | using FromFieldType = typename FromDataType::FieldType; | 689 | 2 | using ToFieldType = typename ToDataType::FieldType; | 690 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 2 | const auto* col_from = | 692 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 2 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 2 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 2 | ToDataType::check_type_precision(to_precision); | 705 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 2 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 2 | constexpr UInt32 to_max_digits = | 716 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 2 | bool multiply_may_overflow = false; | 718 | 2 | if (to_scale > from_scale) { | 719 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 2 | } | 721 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 2 | sizeof(typename ToFieldType::NativeType)), | 723 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 2 | MaxNativeType scale_multiplier = | 725 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 2 | typename ToFieldType::NativeType max_result = | 727 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 2 | NullMap::value_type* null_map_data = nullptr; | 732 | 2 | if (narrow_integral) { | 733 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 1 | null_map_data = col_null_map_to->get_data().data(); | 735 | 1 | } | 736 | | | 737 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 2 | const auto& vec_from = col_from->get_data(); | 739 | 2 | const auto* vec_from_data = vec_from.data(); | 740 | 2 | auto& vec_to = col_to->get_data(); | 741 | 2 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 2 | CastParameters params; | 744 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 2 | size_t size = vec_from.size(); | 746 | | | 747 | 2 | RETURN_IF_ERROR(std::visit( | 748 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 2 | for (size_t i = 0; i < size; i++) { | 750 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 2 | typename ToDataType::FieldType, | 752 | 2 | multiply_may_overflow, narrow_integral>( | 753 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 2 | scale_multiplier, min_result, max_result, params)) { | 755 | 2 | if (set_nullable) { | 756 | 2 | null_map_data[i] = 1; | 757 | 2 | } else { | 758 | 2 | return params.status; | 759 | 2 | } | 760 | 2 | } | 761 | 2 | } | 762 | 2 | return Status::OK(); | 763 | 2 | }, | 764 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 2 | if (narrow_integral) { | 767 | 1 | block.get_by_position(result).column = | 768 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 1 | } else { | 770 | 1 | block.get_by_position(result).column = std::move(col_to); | 771 | 1 | } | 772 | 2 | return Status::OK(); | 773 | 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 | 687 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 2 | using FromFieldType = typename FromDataType::FieldType; | 689 | 2 | using ToFieldType = typename ToDataType::FieldType; | 690 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 2 | const auto* col_from = | 692 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 2 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 2 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 2 | ToDataType::check_type_precision(to_precision); | 705 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 2 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 2 | constexpr UInt32 to_max_digits = | 716 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 2 | bool multiply_may_overflow = false; | 718 | 2 | if (to_scale > from_scale) { | 719 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 2 | } | 721 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 2 | sizeof(typename ToFieldType::NativeType)), | 723 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 2 | MaxNativeType scale_multiplier = | 725 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 2 | typename ToFieldType::NativeType max_result = | 727 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 2 | NullMap::value_type* null_map_data = nullptr; | 732 | 2 | if (narrow_integral) { | 733 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 2 | null_map_data = col_null_map_to->get_data().data(); | 735 | 2 | } | 736 | | | 737 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 2 | const auto& vec_from = col_from->get_data(); | 739 | 2 | const auto* vec_from_data = vec_from.data(); | 740 | 2 | auto& vec_to = col_to->get_data(); | 741 | 2 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 2 | CastParameters params; | 744 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 2 | size_t size = vec_from.size(); | 746 | | | 747 | 2 | RETURN_IF_ERROR(std::visit( | 748 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 2 | for (size_t i = 0; i < size; i++) { | 750 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 2 | typename ToDataType::FieldType, | 752 | 2 | multiply_may_overflow, narrow_integral>( | 753 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 2 | scale_multiplier, min_result, max_result, params)) { | 755 | 2 | if (set_nullable) { | 756 | 2 | null_map_data[i] = 1; | 757 | 2 | } else { | 758 | 2 | return params.status; | 759 | 2 | } | 760 | 2 | } | 761 | 2 | } | 762 | 2 | return Status::OK(); | 763 | 2 | }, | 764 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 1 | if (narrow_integral) { | 767 | 1 | block.get_by_position(result).column = | 768 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 1 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 1 | return Status::OK(); | 773 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 5 | using FromFieldType = typename FromDataType::FieldType; | 689 | 5 | using ToFieldType = typename ToDataType::FieldType; | 690 | 5 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 5 | const auto* col_from = | 692 | 5 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 5 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 5 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 5 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 5 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 5 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 5 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 5 | ToDataType::check_type_precision(to_precision); | 705 | 5 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 5 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 5 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 5 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 5 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 5 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 5 | constexpr UInt32 to_max_digits = | 716 | 5 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 5 | bool multiply_may_overflow = false; | 718 | 5 | if (to_scale > from_scale) { | 719 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 4 | } | 721 | 5 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 5 | sizeof(typename ToFieldType::NativeType)), | 723 | 5 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 5 | MaxNativeType scale_multiplier = | 725 | 5 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 5 | typename ToFieldType::NativeType max_result = | 727 | 5 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 5 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 5 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 5 | NullMap::value_type* null_map_data = nullptr; | 732 | 5 | if (narrow_integral) { | 733 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 1 | null_map_data = col_null_map_to->get_data().data(); | 735 | 1 | } | 736 | | | 737 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 5 | const auto& vec_from = col_from->get_data(); | 739 | 5 | const auto* vec_from_data = vec_from.data(); | 740 | 5 | auto& vec_to = col_to->get_data(); | 741 | 5 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 5 | CastParameters params; | 744 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 5 | size_t size = vec_from.size(); | 746 | | | 747 | 5 | RETURN_IF_ERROR(std::visit( | 748 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 5 | for (size_t i = 0; i < size; i++) { | 750 | 5 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 5 | typename ToDataType::FieldType, | 752 | 5 | multiply_may_overflow, narrow_integral>( | 753 | 5 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 5 | scale_multiplier, min_result, max_result, params)) { | 755 | 5 | if (set_nullable) { | 756 | 5 | null_map_data[i] = 1; | 757 | 5 | } else { | 758 | 5 | return params.status; | 759 | 5 | } | 760 | 5 | } | 761 | 5 | } | 762 | 5 | return Status::OK(); | 763 | 5 | }, | 764 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 5 | if (narrow_integral) { | 767 | 1 | block.get_by_position(result).column = | 768 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 5 | return Status::OK(); | 773 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 23 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 23 | using FromFieldType = typename FromDataType::FieldType; | 689 | 23 | using ToFieldType = typename ToDataType::FieldType; | 690 | 23 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 23 | const auto* col_from = | 692 | 23 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 23 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 23 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 23 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 23 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 23 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 23 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 23 | ToDataType::check_type_precision(to_precision); | 705 | 23 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 23 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 23 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 23 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 23 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 23 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 23 | constexpr UInt32 to_max_digits = | 716 | 23 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 23 | bool multiply_may_overflow = false; | 718 | 23 | if (to_scale > from_scale) { | 719 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 16 | } | 721 | 23 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 23 | sizeof(typename ToFieldType::NativeType)), | 723 | 23 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 23 | MaxNativeType scale_multiplier = | 725 | 23 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 23 | typename ToFieldType::NativeType max_result = | 727 | 23 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 23 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 23 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 23 | NullMap::value_type* null_map_data = nullptr; | 732 | 23 | if (narrow_integral) { | 733 | 20 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 20 | null_map_data = col_null_map_to->get_data().data(); | 735 | 20 | } | 736 | | | 737 | 23 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 23 | const auto& vec_from = col_from->get_data(); | 739 | 23 | const auto* vec_from_data = vec_from.data(); | 740 | 23 | auto& vec_to = col_to->get_data(); | 741 | 23 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 23 | CastParameters params; | 744 | 23 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 23 | size_t size = vec_from.size(); | 746 | | | 747 | 23 | RETURN_IF_ERROR(std::visit( | 748 | 23 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 23 | for (size_t i = 0; i < size; i++) { | 750 | 23 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 23 | typename ToDataType::FieldType, | 752 | 23 | multiply_may_overflow, narrow_integral>( | 753 | 23 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 23 | scale_multiplier, min_result, max_result, params)) { | 755 | 23 | if (set_nullable) { | 756 | 23 | null_map_data[i] = 1; | 757 | 23 | } else { | 758 | 23 | return params.status; | 759 | 23 | } | 760 | 23 | } | 761 | 23 | } | 762 | 23 | return Status::OK(); | 763 | 23 | }, | 764 | 23 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 4 | block.get_by_position(result).column = | 768 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 3 | block.get_by_position(result).column = std::move(col_to); | 771 | 3 | } | 772 | 7 | return Status::OK(); | 773 | 23 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 11 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 11 | using FromFieldType = typename FromDataType::FieldType; | 689 | 11 | using ToFieldType = typename ToDataType::FieldType; | 690 | 11 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 11 | const auto* col_from = | 692 | 11 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 11 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 11 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 11 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 11 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 11 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 11 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 11 | ToDataType::check_type_precision(to_precision); | 705 | 11 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 11 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 11 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 11 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 11 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 11 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 11 | constexpr UInt32 to_max_digits = | 716 | 11 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 11 | bool multiply_may_overflow = false; | 718 | 11 | if (to_scale > from_scale) { | 719 | 7 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 7 | } | 721 | 11 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 11 | sizeof(typename ToFieldType::NativeType)), | 723 | 11 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 11 | MaxNativeType scale_multiplier = | 725 | 11 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 11 | typename ToFieldType::NativeType max_result = | 727 | 11 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 11 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 11 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 11 | NullMap::value_type* null_map_data = nullptr; | 732 | 11 | if (narrow_integral) { | 733 | 8 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 8 | null_map_data = col_null_map_to->get_data().data(); | 735 | 8 | } | 736 | | | 737 | 11 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 11 | const auto& vec_from = col_from->get_data(); | 739 | 11 | const auto* vec_from_data = vec_from.data(); | 740 | 11 | auto& vec_to = col_to->get_data(); | 741 | 11 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 11 | CastParameters params; | 744 | 11 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 11 | size_t size = vec_from.size(); | 746 | | | 747 | 11 | RETURN_IF_ERROR(std::visit( | 748 | 11 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 11 | for (size_t i = 0; i < size; i++) { | 750 | 11 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 11 | typename ToDataType::FieldType, | 752 | 11 | multiply_may_overflow, narrow_integral>( | 753 | 11 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 11 | scale_multiplier, min_result, max_result, params)) { | 755 | 11 | if (set_nullable) { | 756 | 11 | null_map_data[i] = 1; | 757 | 11 | } else { | 758 | 11 | return params.status; | 759 | 11 | } | 760 | 11 | } | 761 | 11 | } | 762 | 11 | return Status::OK(); | 763 | 11 | }, | 764 | 11 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 11 | if (narrow_integral) { | 767 | 8 | block.get_by_position(result).column = | 768 | 8 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 8 | } else { | 770 | 3 | block.get_by_position(result).column = std::move(col_to); | 771 | 3 | } | 772 | 11 | return Status::OK(); | 773 | 11 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 27 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 27 | using FromFieldType = typename FromDataType::FieldType; | 689 | 27 | using ToFieldType = typename ToDataType::FieldType; | 690 | 27 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 27 | const auto* col_from = | 692 | 27 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 27 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 27 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 27 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 27 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 27 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 27 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 27 | ToDataType::check_type_precision(to_precision); | 705 | 27 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 27 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 27 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 27 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 27 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 27 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 27 | constexpr UInt32 to_max_digits = | 716 | 27 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 27 | bool multiply_may_overflow = false; | 718 | 27 | if (to_scale > from_scale) { | 719 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 16 | } | 721 | 27 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 27 | sizeof(typename ToFieldType::NativeType)), | 723 | 27 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 27 | MaxNativeType scale_multiplier = | 725 | 27 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 27 | typename ToFieldType::NativeType max_result = | 727 | 27 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 27 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 27 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 27 | NullMap::value_type* null_map_data = nullptr; | 732 | 27 | if (narrow_integral) { | 733 | 25 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 25 | null_map_data = col_null_map_to->get_data().data(); | 735 | 25 | } | 736 | | | 737 | 27 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 27 | const auto& vec_from = col_from->get_data(); | 739 | 27 | const auto* vec_from_data = vec_from.data(); | 740 | 27 | auto& vec_to = col_to->get_data(); | 741 | 27 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 27 | CastParameters params; | 744 | 27 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 27 | size_t size = vec_from.size(); | 746 | | | 747 | 27 | RETURN_IF_ERROR(std::visit( | 748 | 27 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 27 | for (size_t i = 0; i < size; i++) { | 750 | 27 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 27 | typename ToDataType::FieldType, | 752 | 27 | multiply_may_overflow, narrow_integral>( | 753 | 27 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 27 | scale_multiplier, min_result, max_result, params)) { | 755 | 27 | if (set_nullable) { | 756 | 27 | null_map_data[i] = 1; | 757 | 27 | } else { | 758 | 27 | return params.status; | 759 | 27 | } | 760 | 27 | } | 761 | 27 | } | 762 | 27 | return Status::OK(); | 763 | 27 | }, | 764 | 27 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 5 | block.get_by_position(result).column = | 768 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 5 | } else { | 770 | 2 | block.get_by_position(result).column = std::move(col_to); | 771 | 2 | } | 772 | 7 | return Status::OK(); | 773 | 27 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 12 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 12 | using FromFieldType = typename FromDataType::FieldType; | 689 | 12 | using ToFieldType = typename ToDataType::FieldType; | 690 | 12 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 12 | const auto* col_from = | 692 | 12 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 12 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 12 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 12 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 12 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 12 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 12 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 12 | ToDataType::check_type_precision(to_precision); | 705 | 12 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 12 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 12 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 12 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 12 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 12 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 12 | constexpr UInt32 to_max_digits = | 716 | 12 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 12 | bool multiply_may_overflow = false; | 718 | 12 | if (to_scale > from_scale) { | 719 | 7 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 7 | } | 721 | 12 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 12 | sizeof(typename ToFieldType::NativeType)), | 723 | 12 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 12 | MaxNativeType scale_multiplier = | 725 | 12 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 12 | typename ToFieldType::NativeType max_result = | 727 | 12 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 12 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 12 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 12 | NullMap::value_type* null_map_data = nullptr; | 732 | 12 | if (narrow_integral) { | 733 | 10 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 10 | null_map_data = col_null_map_to->get_data().data(); | 735 | 10 | } | 736 | | | 737 | 12 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 12 | const auto& vec_from = col_from->get_data(); | 739 | 12 | const auto* vec_from_data = vec_from.data(); | 740 | 12 | auto& vec_to = col_to->get_data(); | 741 | 12 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 12 | CastParameters params; | 744 | 12 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 12 | size_t size = vec_from.size(); | 746 | | | 747 | 12 | RETURN_IF_ERROR(std::visit( | 748 | 12 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 12 | for (size_t i = 0; i < size; i++) { | 750 | 12 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 12 | typename ToDataType::FieldType, | 752 | 12 | multiply_may_overflow, narrow_integral>( | 753 | 12 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 12 | scale_multiplier, min_result, max_result, params)) { | 755 | 12 | if (set_nullable) { | 756 | 12 | null_map_data[i] = 1; | 757 | 12 | } else { | 758 | 12 | return params.status; | 759 | 12 | } | 760 | 12 | } | 761 | 12 | } | 762 | 12 | return Status::OK(); | 763 | 12 | }, | 764 | 12 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 12 | if (narrow_integral) { | 767 | 10 | block.get_by_position(result).column = | 768 | 10 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 10 | } else { | 770 | 2 | block.get_by_position(result).column = std::move(col_to); | 771 | 2 | } | 772 | 12 | return Status::OK(); | 773 | 12 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 35 | using FromFieldType = typename FromDataType::FieldType; | 689 | 35 | using ToFieldType = typename ToDataType::FieldType; | 690 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 35 | const auto* col_from = | 692 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 35 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 35 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 35 | ToDataType::check_type_precision(to_precision); | 705 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 35 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 35 | constexpr UInt32 to_max_digits = | 716 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 35 | bool multiply_may_overflow = false; | 718 | 35 | if (to_scale > from_scale) { | 719 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 20 | } | 721 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 35 | sizeof(typename ToFieldType::NativeType)), | 723 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 35 | MaxNativeType scale_multiplier = | 725 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 35 | typename ToFieldType::NativeType max_result = | 727 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 35 | NullMap::value_type* null_map_data = nullptr; | 732 | 35 | if (narrow_integral) { | 733 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 35 | null_map_data = col_null_map_to->get_data().data(); | 735 | 35 | } | 736 | | | 737 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 35 | const auto& vec_from = col_from->get_data(); | 739 | 35 | const auto* vec_from_data = vec_from.data(); | 740 | 35 | auto& vec_to = col_to->get_data(); | 741 | 35 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 35 | CastParameters params; | 744 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 35 | size_t size = vec_from.size(); | 746 | | | 747 | 35 | RETURN_IF_ERROR(std::visit( | 748 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 35 | for (size_t i = 0; i < size; i++) { | 750 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 35 | typename ToDataType::FieldType, | 752 | 35 | multiply_may_overflow, narrow_integral>( | 753 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 35 | scale_multiplier, min_result, max_result, params)) { | 755 | 35 | if (set_nullable) { | 756 | 35 | null_map_data[i] = 1; | 757 | 35 | } else { | 758 | 35 | return params.status; | 759 | 35 | } | 760 | 35 | } | 761 | 35 | } | 762 | 35 | return Status::OK(); | 763 | 35 | }, | 764 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 7 | block.get_by_position(result).column = | 768 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 7 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 7 | return Status::OK(); | 773 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 14 | using FromFieldType = typename FromDataType::FieldType; | 689 | 14 | using ToFieldType = typename ToDataType::FieldType; | 690 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 14 | const auto* col_from = | 692 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 14 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 14 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 14 | ToDataType::check_type_precision(to_precision); | 705 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 14 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 14 | constexpr UInt32 to_max_digits = | 716 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 14 | bool multiply_may_overflow = false; | 718 | 14 | if (to_scale > from_scale) { | 719 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 8 | } | 721 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 14 | sizeof(typename ToFieldType::NativeType)), | 723 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 14 | MaxNativeType scale_multiplier = | 725 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 14 | typename ToFieldType::NativeType max_result = | 727 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 14 | NullMap::value_type* null_map_data = nullptr; | 732 | 14 | if (narrow_integral) { | 733 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 14 | null_map_data = col_null_map_to->get_data().data(); | 735 | 14 | } | 736 | | | 737 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 14 | const auto& vec_from = col_from->get_data(); | 739 | 14 | const auto* vec_from_data = vec_from.data(); | 740 | 14 | auto& vec_to = col_to->get_data(); | 741 | 14 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 14 | CastParameters params; | 744 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 14 | size_t size = vec_from.size(); | 746 | | | 747 | 14 | RETURN_IF_ERROR(std::visit( | 748 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 14 | for (size_t i = 0; i < size; i++) { | 750 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 14 | typename ToDataType::FieldType, | 752 | 14 | multiply_may_overflow, narrow_integral>( | 753 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 14 | scale_multiplier, min_result, max_result, params)) { | 755 | 14 | if (set_nullable) { | 756 | 14 | null_map_data[i] = 1; | 757 | 14 | } else { | 758 | 14 | return params.status; | 759 | 14 | } | 760 | 14 | } | 761 | 14 | } | 762 | 14 | return Status::OK(); | 763 | 14 | }, | 764 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 14 | if (narrow_integral) { | 767 | 14 | block.get_by_position(result).column = | 768 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 14 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 14 | return Status::OK(); | 773 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 35 | using FromFieldType = typename FromDataType::FieldType; | 689 | 35 | using ToFieldType = typename ToDataType::FieldType; | 690 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 35 | const auto* col_from = | 692 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 35 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 35 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 35 | ToDataType::check_type_precision(to_precision); | 705 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 35 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 35 | constexpr UInt32 to_max_digits = | 716 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 35 | bool multiply_may_overflow = false; | 718 | 35 | if (to_scale > from_scale) { | 719 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 20 | } | 721 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 35 | sizeof(typename ToFieldType::NativeType)), | 723 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 35 | MaxNativeType scale_multiplier = | 725 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 35 | typename ToFieldType::NativeType max_result = | 727 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 35 | NullMap::value_type* null_map_data = nullptr; | 732 | 35 | if (narrow_integral) { | 733 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 35 | null_map_data = col_null_map_to->get_data().data(); | 735 | 35 | } | 736 | | | 737 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 35 | const auto& vec_from = col_from->get_data(); | 739 | 35 | const auto* vec_from_data = vec_from.data(); | 740 | 35 | auto& vec_to = col_to->get_data(); | 741 | 35 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 35 | CastParameters params; | 744 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 35 | size_t size = vec_from.size(); | 746 | | | 747 | 35 | RETURN_IF_ERROR(std::visit( | 748 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 35 | for (size_t i = 0; i < size; i++) { | 750 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 35 | typename ToDataType::FieldType, | 752 | 35 | multiply_may_overflow, narrow_integral>( | 753 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 35 | scale_multiplier, min_result, max_result, params)) { | 755 | 35 | if (set_nullable) { | 756 | 35 | null_map_data[i] = 1; | 757 | 35 | } else { | 758 | 35 | return params.status; | 759 | 35 | } | 760 | 35 | } | 761 | 35 | } | 762 | 35 | return Status::OK(); | 763 | 35 | }, | 764 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 7 | block.get_by_position(result).column = | 768 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 7 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 7 | return Status::OK(); | 773 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 14 | using FromFieldType = typename FromDataType::FieldType; | 689 | 14 | using ToFieldType = typename ToDataType::FieldType; | 690 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 14 | const auto* col_from = | 692 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 14 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 14 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 14 | ToDataType::check_type_precision(to_precision); | 705 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 14 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 14 | constexpr UInt32 to_max_digits = | 716 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 14 | bool multiply_may_overflow = false; | 718 | 14 | if (to_scale > from_scale) { | 719 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 8 | } | 721 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 14 | sizeof(typename ToFieldType::NativeType)), | 723 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 14 | MaxNativeType scale_multiplier = | 725 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 14 | typename ToFieldType::NativeType max_result = | 727 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 14 | NullMap::value_type* null_map_data = nullptr; | 732 | 14 | if (narrow_integral) { | 733 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 14 | null_map_data = col_null_map_to->get_data().data(); | 735 | 14 | } | 736 | | | 737 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 14 | const auto& vec_from = col_from->get_data(); | 739 | 14 | const auto* vec_from_data = vec_from.data(); | 740 | 14 | auto& vec_to = col_to->get_data(); | 741 | 14 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 14 | CastParameters params; | 744 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 14 | size_t size = vec_from.size(); | 746 | | | 747 | 14 | RETURN_IF_ERROR(std::visit( | 748 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 14 | for (size_t i = 0; i < size; i++) { | 750 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 14 | typename ToDataType::FieldType, | 752 | 14 | multiply_may_overflow, narrow_integral>( | 753 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 14 | scale_multiplier, min_result, max_result, params)) { | 755 | 14 | if (set_nullable) { | 756 | 14 | null_map_data[i] = 1; | 757 | 14 | } else { | 758 | 14 | return params.status; | 759 | 14 | } | 760 | 14 | } | 761 | 14 | } | 762 | 14 | return Status::OK(); | 763 | 14 | }, | 764 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 14 | if (narrow_integral) { | 767 | 14 | block.get_by_position(result).column = | 768 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 14 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 14 | return Status::OK(); | 773 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 35 | using FromFieldType = typename FromDataType::FieldType; | 689 | 35 | using ToFieldType = typename ToDataType::FieldType; | 690 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 35 | const auto* col_from = | 692 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 35 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 35 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 35 | ToDataType::check_type_precision(to_precision); | 705 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 35 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 35 | constexpr UInt32 to_max_digits = | 716 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 35 | bool multiply_may_overflow = false; | 718 | 35 | if (to_scale > from_scale) { | 719 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 20 | } | 721 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 35 | sizeof(typename ToFieldType::NativeType)), | 723 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 35 | MaxNativeType scale_multiplier = | 725 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 35 | typename ToFieldType::NativeType max_result = | 727 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 35 | NullMap::value_type* null_map_data = nullptr; | 732 | 35 | if (narrow_integral) { | 733 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 35 | null_map_data = col_null_map_to->get_data().data(); | 735 | 35 | } | 736 | | | 737 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 35 | const auto& vec_from = col_from->get_data(); | 739 | 35 | const auto* vec_from_data = vec_from.data(); | 740 | 35 | auto& vec_to = col_to->get_data(); | 741 | 35 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 35 | CastParameters params; | 744 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 35 | size_t size = vec_from.size(); | 746 | | | 747 | 35 | RETURN_IF_ERROR(std::visit( | 748 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 35 | for (size_t i = 0; i < size; i++) { | 750 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 35 | typename ToDataType::FieldType, | 752 | 35 | multiply_may_overflow, narrow_integral>( | 753 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 35 | scale_multiplier, min_result, max_result, params)) { | 755 | 35 | if (set_nullable) { | 756 | 35 | null_map_data[i] = 1; | 757 | 35 | } else { | 758 | 35 | return params.status; | 759 | 35 | } | 760 | 35 | } | 761 | 35 | } | 762 | 35 | return Status::OK(); | 763 | 35 | }, | 764 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 7 | block.get_by_position(result).column = | 768 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 7 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 7 | return Status::OK(); | 773 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 14 | using FromFieldType = typename FromDataType::FieldType; | 689 | 14 | using ToFieldType = typename ToDataType::FieldType; | 690 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 14 | const auto* col_from = | 692 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 14 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 14 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 14 | ToDataType::check_type_precision(to_precision); | 705 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 14 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 14 | constexpr UInt32 to_max_digits = | 716 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 14 | bool multiply_may_overflow = false; | 718 | 14 | if (to_scale > from_scale) { | 719 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 8 | } | 721 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 14 | sizeof(typename ToFieldType::NativeType)), | 723 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 14 | MaxNativeType scale_multiplier = | 725 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 14 | typename ToFieldType::NativeType max_result = | 727 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 14 | NullMap::value_type* null_map_data = nullptr; | 732 | 14 | if (narrow_integral) { | 733 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 14 | null_map_data = col_null_map_to->get_data().data(); | 735 | 14 | } | 736 | | | 737 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 14 | const auto& vec_from = col_from->get_data(); | 739 | 14 | const auto* vec_from_data = vec_from.data(); | 740 | 14 | auto& vec_to = col_to->get_data(); | 741 | 14 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 14 | CastParameters params; | 744 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 14 | size_t size = vec_from.size(); | 746 | | | 747 | 14 | RETURN_IF_ERROR(std::visit( | 748 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 14 | for (size_t i = 0; i < size; i++) { | 750 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 14 | typename ToDataType::FieldType, | 752 | 14 | multiply_may_overflow, narrow_integral>( | 753 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 14 | scale_multiplier, min_result, max_result, params)) { | 755 | 14 | if (set_nullable) { | 756 | 14 | null_map_data[i] = 1; | 757 | 14 | } else { | 758 | 14 | return params.status; | 759 | 14 | } | 760 | 14 | } | 761 | 14 | } | 762 | 14 | return Status::OK(); | 763 | 14 | }, | 764 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 14 | if (narrow_integral) { | 767 | 14 | block.get_by_position(result).column = | 768 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 14 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 14 | return Status::OK(); | 773 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 2 | using FromFieldType = typename FromDataType::FieldType; | 689 | 2 | using ToFieldType = typename ToDataType::FieldType; | 690 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 2 | const auto* col_from = | 692 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 2 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 2 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 2 | ToDataType::check_type_precision(to_precision); | 705 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 2 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 2 | constexpr UInt32 to_max_digits = | 716 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 2 | bool multiply_may_overflow = false; | 718 | 2 | if (to_scale > from_scale) { | 719 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 2 | } | 721 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 2 | sizeof(typename ToFieldType::NativeType)), | 723 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 2 | MaxNativeType scale_multiplier = | 725 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 2 | typename ToFieldType::NativeType max_result = | 727 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 2 | NullMap::value_type* null_map_data = nullptr; | 732 | 2 | if (narrow_integral) { | 733 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 2 | null_map_data = col_null_map_to->get_data().data(); | 735 | 2 | } | 736 | | | 737 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 2 | const auto& vec_from = col_from->get_data(); | 739 | 2 | const auto* vec_from_data = vec_from.data(); | 740 | 2 | auto& vec_to = col_to->get_data(); | 741 | 2 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 2 | CastParameters params; | 744 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 2 | size_t size = vec_from.size(); | 746 | | | 747 | 2 | RETURN_IF_ERROR(std::visit( | 748 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 2 | for (size_t i = 0; i < size; i++) { | 750 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 2 | typename ToDataType::FieldType, | 752 | 2 | multiply_may_overflow, narrow_integral>( | 753 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 2 | scale_multiplier, min_result, max_result, params)) { | 755 | 2 | if (set_nullable) { | 756 | 2 | null_map_data[i] = 1; | 757 | 2 | } else { | 758 | 2 | return params.status; | 759 | 2 | } | 760 | 2 | } | 761 | 2 | } | 762 | 2 | return Status::OK(); | 763 | 2 | }, | 764 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 1 | if (narrow_integral) { | 767 | 1 | block.get_by_position(result).column = | 768 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 1 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 1 | return Status::OK(); | 773 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 5 | using FromFieldType = typename FromDataType::FieldType; | 689 | 5 | using ToFieldType = typename ToDataType::FieldType; | 690 | 5 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 5 | const auto* col_from = | 692 | 5 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 5 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 5 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 5 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 5 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 5 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 5 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 5 | ToDataType::check_type_precision(to_precision); | 705 | 5 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 5 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 5 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 5 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 5 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 5 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 5 | constexpr UInt32 to_max_digits = | 716 | 5 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 5 | bool multiply_may_overflow = false; | 718 | 5 | if (to_scale > from_scale) { | 719 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 4 | } | 721 | 5 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 5 | sizeof(typename ToFieldType::NativeType)), | 723 | 5 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 5 | MaxNativeType scale_multiplier = | 725 | 5 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 5 | typename ToFieldType::NativeType max_result = | 727 | 5 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 5 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 5 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 5 | NullMap::value_type* null_map_data = nullptr; | 732 | 5 | if (narrow_integral) { | 733 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 1 | null_map_data = col_null_map_to->get_data().data(); | 735 | 1 | } | 736 | | | 737 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 5 | const auto& vec_from = col_from->get_data(); | 739 | 5 | const auto* vec_from_data = vec_from.data(); | 740 | 5 | auto& vec_to = col_to->get_data(); | 741 | 5 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 5 | CastParameters params; | 744 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 5 | size_t size = vec_from.size(); | 746 | | | 747 | 5 | RETURN_IF_ERROR(std::visit( | 748 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 5 | for (size_t i = 0; i < size; i++) { | 750 | 5 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 5 | typename ToDataType::FieldType, | 752 | 5 | multiply_may_overflow, narrow_integral>( | 753 | 5 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 5 | scale_multiplier, min_result, max_result, params)) { | 755 | 5 | if (set_nullable) { | 756 | 5 | null_map_data[i] = 1; | 757 | 5 | } else { | 758 | 5 | return params.status; | 759 | 5 | } | 760 | 5 | } | 761 | 5 | } | 762 | 5 | return Status::OK(); | 763 | 5 | }, | 764 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 5 | if (narrow_integral) { | 767 | 1 | block.get_by_position(result).column = | 768 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 5 | return Status::OK(); | 773 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 19 | using FromFieldType = typename FromDataType::FieldType; | 689 | 19 | using ToFieldType = typename ToDataType::FieldType; | 690 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 19 | const auto* col_from = | 692 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 19 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 19 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 19 | ToDataType::check_type_precision(to_precision); | 705 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 19 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 19 | constexpr UInt32 to_max_digits = | 716 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 19 | bool multiply_may_overflow = false; | 718 | 19 | if (to_scale > from_scale) { | 719 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 12 | } | 721 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 19 | sizeof(typename ToFieldType::NativeType)), | 723 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 19 | MaxNativeType scale_multiplier = | 725 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 19 | typename ToFieldType::NativeType max_result = | 727 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 19 | NullMap::value_type* null_map_data = nullptr; | 732 | 19 | if (narrow_integral) { | 733 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 15 | null_map_data = col_null_map_to->get_data().data(); | 735 | 15 | } | 736 | | | 737 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 19 | const auto& vec_from = col_from->get_data(); | 739 | 19 | const auto* vec_from_data = vec_from.data(); | 740 | 19 | auto& vec_to = col_to->get_data(); | 741 | 19 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 19 | CastParameters params; | 744 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 19 | size_t size = vec_from.size(); | 746 | | | 747 | 19 | RETURN_IF_ERROR(std::visit( | 748 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 19 | for (size_t i = 0; i < size; i++) { | 750 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 19 | typename ToDataType::FieldType, | 752 | 19 | multiply_may_overflow, narrow_integral>( | 753 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 19 | scale_multiplier, min_result, max_result, params)) { | 755 | 19 | if (set_nullable) { | 756 | 19 | null_map_data[i] = 1; | 757 | 19 | } else { | 758 | 19 | return params.status; | 759 | 19 | } | 760 | 19 | } | 761 | 19 | } | 762 | 19 | return Status::OK(); | 763 | 19 | }, | 764 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 3 | block.get_by_position(result).column = | 768 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 7 | return Status::OK(); | 773 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 10 | using FromFieldType = typename FromDataType::FieldType; | 689 | 10 | using ToFieldType = typename ToDataType::FieldType; | 690 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 10 | const auto* col_from = | 692 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 10 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 10 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 10 | ToDataType::check_type_precision(to_precision); | 705 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 10 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 10 | constexpr UInt32 to_max_digits = | 716 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 10 | bool multiply_may_overflow = false; | 718 | 10 | if (to_scale > from_scale) { | 719 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 6 | } | 721 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 10 | sizeof(typename ToFieldType::NativeType)), | 723 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 10 | MaxNativeType scale_multiplier = | 725 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 10 | typename ToFieldType::NativeType max_result = | 727 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 10 | NullMap::value_type* null_map_data = nullptr; | 732 | 10 | if (narrow_integral) { | 733 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 6 | null_map_data = col_null_map_to->get_data().data(); | 735 | 6 | } | 736 | | | 737 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 10 | const auto& vec_from = col_from->get_data(); | 739 | 10 | const auto* vec_from_data = vec_from.data(); | 740 | 10 | auto& vec_to = col_to->get_data(); | 741 | 10 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 10 | CastParameters params; | 744 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 10 | size_t size = vec_from.size(); | 746 | | | 747 | 10 | RETURN_IF_ERROR(std::visit( | 748 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 10 | for (size_t i = 0; i < size; i++) { | 750 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 10 | typename ToDataType::FieldType, | 752 | 10 | multiply_may_overflow, narrow_integral>( | 753 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 10 | scale_multiplier, min_result, max_result, params)) { | 755 | 10 | if (set_nullable) { | 756 | 10 | null_map_data[i] = 1; | 757 | 10 | } else { | 758 | 10 | return params.status; | 759 | 10 | } | 760 | 10 | } | 761 | 10 | } | 762 | 10 | return Status::OK(); | 763 | 10 | }, | 764 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 10 | if (narrow_integral) { | 767 | 6 | block.get_by_position(result).column = | 768 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 6 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 10 | return Status::OK(); | 773 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 19 | using FromFieldType = typename FromDataType::FieldType; | 689 | 19 | using ToFieldType = typename ToDataType::FieldType; | 690 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 19 | const auto* col_from = | 692 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 19 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 19 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 19 | ToDataType::check_type_precision(to_precision); | 705 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 19 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 19 | constexpr UInt32 to_max_digits = | 716 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 19 | bool multiply_may_overflow = false; | 718 | 19 | if (to_scale > from_scale) { | 719 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 12 | } | 721 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 19 | sizeof(typename ToFieldType::NativeType)), | 723 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 19 | MaxNativeType scale_multiplier = | 725 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 19 | typename ToFieldType::NativeType max_result = | 727 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 19 | NullMap::value_type* null_map_data = nullptr; | 732 | 19 | if (narrow_integral) { | 733 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 15 | null_map_data = col_null_map_to->get_data().data(); | 735 | 15 | } | 736 | | | 737 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 19 | const auto& vec_from = col_from->get_data(); | 739 | 19 | const auto* vec_from_data = vec_from.data(); | 740 | 19 | auto& vec_to = col_to->get_data(); | 741 | 19 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 19 | CastParameters params; | 744 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 19 | size_t size = vec_from.size(); | 746 | | | 747 | 19 | RETURN_IF_ERROR(std::visit( | 748 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 19 | for (size_t i = 0; i < size; i++) { | 750 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 19 | typename ToDataType::FieldType, | 752 | 19 | multiply_may_overflow, narrow_integral>( | 753 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 19 | scale_multiplier, min_result, max_result, params)) { | 755 | 19 | if (set_nullable) { | 756 | 19 | null_map_data[i] = 1; | 757 | 19 | } else { | 758 | 19 | return params.status; | 759 | 19 | } | 760 | 19 | } | 761 | 19 | } | 762 | 19 | return Status::OK(); | 763 | 19 | }, | 764 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 3 | block.get_by_position(result).column = | 768 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 7 | return Status::OK(); | 773 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 10 | using FromFieldType = typename FromDataType::FieldType; | 689 | 10 | using ToFieldType = typename ToDataType::FieldType; | 690 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 10 | const auto* col_from = | 692 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 10 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 10 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 10 | ToDataType::check_type_precision(to_precision); | 705 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 10 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 10 | constexpr UInt32 to_max_digits = | 716 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 10 | bool multiply_may_overflow = false; | 718 | 10 | if (to_scale > from_scale) { | 719 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 6 | } | 721 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 10 | sizeof(typename ToFieldType::NativeType)), | 723 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 10 | MaxNativeType scale_multiplier = | 725 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 10 | typename ToFieldType::NativeType max_result = | 727 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 10 | NullMap::value_type* null_map_data = nullptr; | 732 | 10 | if (narrow_integral) { | 733 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 6 | null_map_data = col_null_map_to->get_data().data(); | 735 | 6 | } | 736 | | | 737 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 10 | const auto& vec_from = col_from->get_data(); | 739 | 10 | const auto* vec_from_data = vec_from.data(); | 740 | 10 | auto& vec_to = col_to->get_data(); | 741 | 10 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 10 | CastParameters params; | 744 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 10 | size_t size = vec_from.size(); | 746 | | | 747 | 10 | RETURN_IF_ERROR(std::visit( | 748 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 10 | for (size_t i = 0; i < size; i++) { | 750 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 10 | typename ToDataType::FieldType, | 752 | 10 | multiply_may_overflow, narrow_integral>( | 753 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 10 | scale_multiplier, min_result, max_result, params)) { | 755 | 10 | if (set_nullable) { | 756 | 10 | null_map_data[i] = 1; | 757 | 10 | } else { | 758 | 10 | return params.status; | 759 | 10 | } | 760 | 10 | } | 761 | 10 | } | 762 | 10 | return Status::OK(); | 763 | 10 | }, | 764 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 10 | if (narrow_integral) { | 767 | 6 | block.get_by_position(result).column = | 768 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 6 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 10 | return Status::OK(); | 773 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 31 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 31 | using FromFieldType = typename FromDataType::FieldType; | 689 | 31 | using ToFieldType = typename ToDataType::FieldType; | 690 | 31 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 31 | const auto* col_from = | 692 | 31 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 31 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 31 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 31 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 31 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 31 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 31 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 31 | ToDataType::check_type_precision(to_precision); | 705 | 31 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 31 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 31 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 31 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 31 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 31 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 31 | constexpr UInt32 to_max_digits = | 716 | 31 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 31 | bool multiply_may_overflow = false; | 718 | 31 | if (to_scale > from_scale) { | 719 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 20 | } | 721 | 31 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 31 | sizeof(typename ToFieldType::NativeType)), | 723 | 31 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 31 | MaxNativeType scale_multiplier = | 725 | 31 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 31 | typename ToFieldType::NativeType max_result = | 727 | 31 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 31 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 31 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 31 | NullMap::value_type* null_map_data = nullptr; | 732 | 31 | if (narrow_integral) { | 733 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 30 | null_map_data = col_null_map_to->get_data().data(); | 735 | 30 | } | 736 | | | 737 | 31 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 31 | const auto& vec_from = col_from->get_data(); | 739 | 31 | const auto* vec_from_data = vec_from.data(); | 740 | 31 | auto& vec_to = col_to->get_data(); | 741 | 31 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 31 | CastParameters params; | 744 | 31 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 31 | size_t size = vec_from.size(); | 746 | | | 747 | 31 | RETURN_IF_ERROR(std::visit( | 748 | 31 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 31 | for (size_t i = 0; i < size; i++) { | 750 | 31 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 31 | typename ToDataType::FieldType, | 752 | 31 | multiply_may_overflow, narrow_integral>( | 753 | 31 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 31 | scale_multiplier, min_result, max_result, params)) { | 755 | 31 | if (set_nullable) { | 756 | 31 | null_map_data[i] = 1; | 757 | 31 | } else { | 758 | 31 | return params.status; | 759 | 31 | } | 760 | 31 | } | 761 | 31 | } | 762 | 31 | return Status::OK(); | 763 | 31 | }, | 764 | 31 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 6 | block.get_by_position(result).column = | 768 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 6 | } else { | 770 | 1 | block.get_by_position(result).column = std::move(col_to); | 771 | 1 | } | 772 | 7 | return Status::OK(); | 773 | 31 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 13 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 13 | using FromFieldType = typename FromDataType::FieldType; | 689 | 13 | using ToFieldType = typename ToDataType::FieldType; | 690 | 13 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 13 | const auto* col_from = | 692 | 13 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 13 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 13 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 13 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 13 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 13 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 13 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 13 | ToDataType::check_type_precision(to_precision); | 705 | 13 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 13 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 13 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 13 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 13 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 13 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 13 | constexpr UInt32 to_max_digits = | 716 | 13 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 13 | bool multiply_may_overflow = false; | 718 | 13 | if (to_scale > from_scale) { | 719 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 8 | } | 721 | 13 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 13 | sizeof(typename ToFieldType::NativeType)), | 723 | 13 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 13 | MaxNativeType scale_multiplier = | 725 | 13 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 13 | typename ToFieldType::NativeType max_result = | 727 | 13 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 13 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 13 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 13 | NullMap::value_type* null_map_data = nullptr; | 732 | 13 | if (narrow_integral) { | 733 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 12 | null_map_data = col_null_map_to->get_data().data(); | 735 | 12 | } | 736 | | | 737 | 13 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 13 | const auto& vec_from = col_from->get_data(); | 739 | 13 | const auto* vec_from_data = vec_from.data(); | 740 | 13 | auto& vec_to = col_to->get_data(); | 741 | 13 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 13 | CastParameters params; | 744 | 13 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 13 | size_t size = vec_from.size(); | 746 | | | 747 | 13 | RETURN_IF_ERROR(std::visit( | 748 | 13 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 13 | for (size_t i = 0; i < size; i++) { | 750 | 13 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 13 | typename ToDataType::FieldType, | 752 | 13 | multiply_may_overflow, narrow_integral>( | 753 | 13 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 13 | scale_multiplier, min_result, max_result, params)) { | 755 | 13 | if (set_nullable) { | 756 | 13 | null_map_data[i] = 1; | 757 | 13 | } else { | 758 | 13 | return params.status; | 759 | 13 | } | 760 | 13 | } | 761 | 13 | } | 762 | 13 | return Status::OK(); | 763 | 13 | }, | 764 | 13 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 13 | if (narrow_integral) { | 767 | 12 | block.get_by_position(result).column = | 768 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 12 | } else { | 770 | 1 | block.get_by_position(result).column = std::move(col_to); | 771 | 1 | } | 772 | 13 | return Status::OK(); | 773 | 13 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 35 | using FromFieldType = typename FromDataType::FieldType; | 689 | 35 | using ToFieldType = typename ToDataType::FieldType; | 690 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 35 | const auto* col_from = | 692 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 35 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 35 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 35 | ToDataType::check_type_precision(to_precision); | 705 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 35 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 35 | constexpr UInt32 to_max_digits = | 716 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 35 | bool multiply_may_overflow = false; | 718 | 35 | if (to_scale > from_scale) { | 719 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 20 | } | 721 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 35 | sizeof(typename ToFieldType::NativeType)), | 723 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 35 | MaxNativeType scale_multiplier = | 725 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 35 | typename ToFieldType::NativeType max_result = | 727 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 35 | NullMap::value_type* null_map_data = nullptr; | 732 | 35 | if (narrow_integral) { | 733 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 35 | null_map_data = col_null_map_to->get_data().data(); | 735 | 35 | } | 736 | | | 737 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 35 | const auto& vec_from = col_from->get_data(); | 739 | 35 | const auto* vec_from_data = vec_from.data(); | 740 | 35 | auto& vec_to = col_to->get_data(); | 741 | 35 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 35 | CastParameters params; | 744 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 35 | size_t size = vec_from.size(); | 746 | | | 747 | 35 | RETURN_IF_ERROR(std::visit( | 748 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 35 | for (size_t i = 0; i < size; i++) { | 750 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 35 | typename ToDataType::FieldType, | 752 | 35 | multiply_may_overflow, narrow_integral>( | 753 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 35 | scale_multiplier, min_result, max_result, params)) { | 755 | 35 | if (set_nullable) { | 756 | 35 | null_map_data[i] = 1; | 757 | 35 | } else { | 758 | 35 | return params.status; | 759 | 35 | } | 760 | 35 | } | 761 | 35 | } | 762 | 35 | return Status::OK(); | 763 | 35 | }, | 764 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 7 | block.get_by_position(result).column = | 768 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 7 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 7 | return Status::OK(); | 773 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 14 | using FromFieldType = typename FromDataType::FieldType; | 689 | 14 | using ToFieldType = typename ToDataType::FieldType; | 690 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 14 | const auto* col_from = | 692 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 14 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 14 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 14 | ToDataType::check_type_precision(to_precision); | 705 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 14 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 14 | constexpr UInt32 to_max_digits = | 716 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 14 | bool multiply_may_overflow = false; | 718 | 14 | if (to_scale > from_scale) { | 719 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 8 | } | 721 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 14 | sizeof(typename ToFieldType::NativeType)), | 723 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 14 | MaxNativeType scale_multiplier = | 725 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 14 | typename ToFieldType::NativeType max_result = | 727 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 14 | NullMap::value_type* null_map_data = nullptr; | 732 | 14 | if (narrow_integral) { | 733 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 14 | null_map_data = col_null_map_to->get_data().data(); | 735 | 14 | } | 736 | | | 737 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 14 | const auto& vec_from = col_from->get_data(); | 739 | 14 | const auto* vec_from_data = vec_from.data(); | 740 | 14 | auto& vec_to = col_to->get_data(); | 741 | 14 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 14 | CastParameters params; | 744 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 14 | size_t size = vec_from.size(); | 746 | | | 747 | 14 | RETURN_IF_ERROR(std::visit( | 748 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 14 | for (size_t i = 0; i < size; i++) { | 750 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 14 | typename ToDataType::FieldType, | 752 | 14 | multiply_may_overflow, narrow_integral>( | 753 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 14 | scale_multiplier, min_result, max_result, params)) { | 755 | 14 | if (set_nullable) { | 756 | 14 | null_map_data[i] = 1; | 757 | 14 | } else { | 758 | 14 | return params.status; | 759 | 14 | } | 760 | 14 | } | 761 | 14 | } | 762 | 14 | return Status::OK(); | 763 | 14 | }, | 764 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 14 | if (narrow_integral) { | 767 | 14 | block.get_by_position(result).column = | 768 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 14 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 14 | return Status::OK(); | 773 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 35 | using FromFieldType = typename FromDataType::FieldType; | 689 | 35 | using ToFieldType = typename ToDataType::FieldType; | 690 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 35 | const auto* col_from = | 692 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 35 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 35 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 35 | ToDataType::check_type_precision(to_precision); | 705 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 35 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 35 | constexpr UInt32 to_max_digits = | 716 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 35 | bool multiply_may_overflow = false; | 718 | 35 | if (to_scale > from_scale) { | 719 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 20 | } | 721 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 35 | sizeof(typename ToFieldType::NativeType)), | 723 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 35 | MaxNativeType scale_multiplier = | 725 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 35 | typename ToFieldType::NativeType max_result = | 727 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 35 | NullMap::value_type* null_map_data = nullptr; | 732 | 35 | if (narrow_integral) { | 733 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 35 | null_map_data = col_null_map_to->get_data().data(); | 735 | 35 | } | 736 | | | 737 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 35 | const auto& vec_from = col_from->get_data(); | 739 | 35 | const auto* vec_from_data = vec_from.data(); | 740 | 35 | auto& vec_to = col_to->get_data(); | 741 | 35 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 35 | CastParameters params; | 744 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 35 | size_t size = vec_from.size(); | 746 | | | 747 | 35 | RETURN_IF_ERROR(std::visit( | 748 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 35 | for (size_t i = 0; i < size; i++) { | 750 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 35 | typename ToDataType::FieldType, | 752 | 35 | multiply_may_overflow, narrow_integral>( | 753 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 35 | scale_multiplier, min_result, max_result, params)) { | 755 | 35 | if (set_nullable) { | 756 | 35 | null_map_data[i] = 1; | 757 | 35 | } else { | 758 | 35 | return params.status; | 759 | 35 | } | 760 | 35 | } | 761 | 35 | } | 762 | 35 | return Status::OK(); | 763 | 35 | }, | 764 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 7 | block.get_by_position(result).column = | 768 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 7 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 7 | return Status::OK(); | 773 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 14 | using FromFieldType = typename FromDataType::FieldType; | 689 | 14 | using ToFieldType = typename ToDataType::FieldType; | 690 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 14 | const auto* col_from = | 692 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 14 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 14 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 14 | ToDataType::check_type_precision(to_precision); | 705 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 14 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 14 | constexpr UInt32 to_max_digits = | 716 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 14 | bool multiply_may_overflow = false; | 718 | 14 | if (to_scale > from_scale) { | 719 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 8 | } | 721 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 14 | sizeof(typename ToFieldType::NativeType)), | 723 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 14 | MaxNativeType scale_multiplier = | 725 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 14 | typename ToFieldType::NativeType max_result = | 727 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 14 | NullMap::value_type* null_map_data = nullptr; | 732 | 14 | if (narrow_integral) { | 733 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 14 | null_map_data = col_null_map_to->get_data().data(); | 735 | 14 | } | 736 | | | 737 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 14 | const auto& vec_from = col_from->get_data(); | 739 | 14 | const auto* vec_from_data = vec_from.data(); | 740 | 14 | auto& vec_to = col_to->get_data(); | 741 | 14 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 14 | CastParameters params; | 744 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 14 | size_t size = vec_from.size(); | 746 | | | 747 | 14 | RETURN_IF_ERROR(std::visit( | 748 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 14 | for (size_t i = 0; i < size; i++) { | 750 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 14 | typename ToDataType::FieldType, | 752 | 14 | multiply_may_overflow, narrow_integral>( | 753 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 14 | scale_multiplier, min_result, max_result, params)) { | 755 | 14 | if (set_nullable) { | 756 | 14 | null_map_data[i] = 1; | 757 | 14 | } else { | 758 | 14 | return params.status; | 759 | 14 | } | 760 | 14 | } | 761 | 14 | } | 762 | 14 | return Status::OK(); | 763 | 14 | }, | 764 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 14 | if (narrow_integral) { | 767 | 14 | block.get_by_position(result).column = | 768 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 14 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 14 | return Status::OK(); | 773 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 2 | using FromFieldType = typename FromDataType::FieldType; | 689 | 2 | using ToFieldType = typename ToDataType::FieldType; | 690 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 2 | const auto* col_from = | 692 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 2 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 2 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 2 | ToDataType::check_type_precision(to_precision); | 705 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 2 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 2 | constexpr UInt32 to_max_digits = | 716 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 2 | bool multiply_may_overflow = false; | 718 | 2 | if (to_scale > from_scale) { | 719 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 2 | } | 721 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 2 | sizeof(typename ToFieldType::NativeType)), | 723 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 2 | MaxNativeType scale_multiplier = | 725 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 2 | typename ToFieldType::NativeType max_result = | 727 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 2 | NullMap::value_type* null_map_data = nullptr; | 732 | 2 | if (narrow_integral) { | 733 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 2 | null_map_data = col_null_map_to->get_data().data(); | 735 | 2 | } | 736 | | | 737 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 2 | const auto& vec_from = col_from->get_data(); | 739 | 2 | const auto* vec_from_data = vec_from.data(); | 740 | 2 | auto& vec_to = col_to->get_data(); | 741 | 2 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 2 | CastParameters params; | 744 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 2 | size_t size = vec_from.size(); | 746 | | | 747 | 2 | RETURN_IF_ERROR(std::visit( | 748 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 2 | for (size_t i = 0; i < size; i++) { | 750 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 2 | typename ToDataType::FieldType, | 752 | 2 | multiply_may_overflow, narrow_integral>( | 753 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 2 | scale_multiplier, min_result, max_result, params)) { | 755 | 2 | if (set_nullable) { | 756 | 2 | null_map_data[i] = 1; | 757 | 2 | } else { | 758 | 2 | return params.status; | 759 | 2 | } | 760 | 2 | } | 761 | 2 | } | 762 | 2 | return Status::OK(); | 763 | 2 | }, | 764 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 1 | if (narrow_integral) { | 767 | 1 | block.get_by_position(result).column = | 768 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 1 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 1 | return Status::OK(); | 773 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 5 | using FromFieldType = typename FromDataType::FieldType; | 689 | 5 | using ToFieldType = typename ToDataType::FieldType; | 690 | 5 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 5 | const auto* col_from = | 692 | 5 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 5 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 5 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 5 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 5 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 5 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 5 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 5 | ToDataType::check_type_precision(to_precision); | 705 | 5 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 5 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 5 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 5 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 5 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 5 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 5 | constexpr UInt32 to_max_digits = | 716 | 5 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 5 | bool multiply_may_overflow = false; | 718 | 5 | if (to_scale > from_scale) { | 719 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 4 | } | 721 | 5 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 5 | sizeof(typename ToFieldType::NativeType)), | 723 | 5 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 5 | MaxNativeType scale_multiplier = | 725 | 5 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 5 | typename ToFieldType::NativeType max_result = | 727 | 5 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 5 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 5 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 5 | NullMap::value_type* null_map_data = nullptr; | 732 | 5 | if (narrow_integral) { | 733 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 1 | null_map_data = col_null_map_to->get_data().data(); | 735 | 1 | } | 736 | | | 737 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 5 | const auto& vec_from = col_from->get_data(); | 739 | 5 | const auto* vec_from_data = vec_from.data(); | 740 | 5 | auto& vec_to = col_to->get_data(); | 741 | 5 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 5 | CastParameters params; | 744 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 5 | size_t size = vec_from.size(); | 746 | | | 747 | 5 | RETURN_IF_ERROR(std::visit( | 748 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 5 | for (size_t i = 0; i < size; i++) { | 750 | 5 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 5 | typename ToDataType::FieldType, | 752 | 5 | multiply_may_overflow, narrow_integral>( | 753 | 5 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 5 | scale_multiplier, min_result, max_result, params)) { | 755 | 5 | if (set_nullable) { | 756 | 5 | null_map_data[i] = 1; | 757 | 5 | } else { | 758 | 5 | return params.status; | 759 | 5 | } | 760 | 5 | } | 761 | 5 | } | 762 | 5 | return Status::OK(); | 763 | 5 | }, | 764 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 5 | if (narrow_integral) { | 767 | 1 | block.get_by_position(result).column = | 768 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 5 | return Status::OK(); | 773 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 19 | using FromFieldType = typename FromDataType::FieldType; | 689 | 19 | using ToFieldType = typename ToDataType::FieldType; | 690 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 19 | const auto* col_from = | 692 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 19 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 19 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 19 | ToDataType::check_type_precision(to_precision); | 705 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 19 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 19 | constexpr UInt32 to_max_digits = | 716 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 19 | bool multiply_may_overflow = false; | 718 | 19 | if (to_scale > from_scale) { | 719 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 12 | } | 721 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 19 | sizeof(typename ToFieldType::NativeType)), | 723 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 19 | MaxNativeType scale_multiplier = | 725 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 19 | typename ToFieldType::NativeType max_result = | 727 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 19 | NullMap::value_type* null_map_data = nullptr; | 732 | 19 | if (narrow_integral) { | 733 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 15 | null_map_data = col_null_map_to->get_data().data(); | 735 | 15 | } | 736 | | | 737 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 19 | const auto& vec_from = col_from->get_data(); | 739 | 19 | const auto* vec_from_data = vec_from.data(); | 740 | 19 | auto& vec_to = col_to->get_data(); | 741 | 19 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 19 | CastParameters params; | 744 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 19 | size_t size = vec_from.size(); | 746 | | | 747 | 19 | RETURN_IF_ERROR(std::visit( | 748 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 19 | for (size_t i = 0; i < size; i++) { | 750 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 19 | typename ToDataType::FieldType, | 752 | 19 | multiply_may_overflow, narrow_integral>( | 753 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 19 | scale_multiplier, min_result, max_result, params)) { | 755 | 19 | if (set_nullable) { | 756 | 19 | null_map_data[i] = 1; | 757 | 19 | } else { | 758 | 19 | return params.status; | 759 | 19 | } | 760 | 19 | } | 761 | 19 | } | 762 | 19 | return Status::OK(); | 763 | 19 | }, | 764 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 3 | block.get_by_position(result).column = | 768 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 7 | return Status::OK(); | 773 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 10 | using FromFieldType = typename FromDataType::FieldType; | 689 | 10 | using ToFieldType = typename ToDataType::FieldType; | 690 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 10 | const auto* col_from = | 692 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 10 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 10 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 10 | ToDataType::check_type_precision(to_precision); | 705 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 10 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 10 | constexpr UInt32 to_max_digits = | 716 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 10 | bool multiply_may_overflow = false; | 718 | 10 | if (to_scale > from_scale) { | 719 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 6 | } | 721 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 10 | sizeof(typename ToFieldType::NativeType)), | 723 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 10 | MaxNativeType scale_multiplier = | 725 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 10 | typename ToFieldType::NativeType max_result = | 727 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 10 | NullMap::value_type* null_map_data = nullptr; | 732 | 10 | if (narrow_integral) { | 733 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 6 | null_map_data = col_null_map_to->get_data().data(); | 735 | 6 | } | 736 | | | 737 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 10 | const auto& vec_from = col_from->get_data(); | 739 | 10 | const auto* vec_from_data = vec_from.data(); | 740 | 10 | auto& vec_to = col_to->get_data(); | 741 | 10 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 10 | CastParameters params; | 744 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 10 | size_t size = vec_from.size(); | 746 | | | 747 | 10 | RETURN_IF_ERROR(std::visit( | 748 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 10 | for (size_t i = 0; i < size; i++) { | 750 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 10 | typename ToDataType::FieldType, | 752 | 10 | multiply_may_overflow, narrow_integral>( | 753 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 10 | scale_multiplier, min_result, max_result, params)) { | 755 | 10 | if (set_nullable) { | 756 | 10 | null_map_data[i] = 1; | 757 | 10 | } else { | 758 | 10 | return params.status; | 759 | 10 | } | 760 | 10 | } | 761 | 10 | } | 762 | 10 | return Status::OK(); | 763 | 10 | }, | 764 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 10 | if (narrow_integral) { | 767 | 6 | block.get_by_position(result).column = | 768 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 6 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 10 | return Status::OK(); | 773 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 19 | using FromFieldType = typename FromDataType::FieldType; | 689 | 19 | using ToFieldType = typename ToDataType::FieldType; | 690 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 19 | const auto* col_from = | 692 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 19 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 19 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 19 | ToDataType::check_type_precision(to_precision); | 705 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 19 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 19 | constexpr UInt32 to_max_digits = | 716 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 19 | bool multiply_may_overflow = false; | 718 | 19 | if (to_scale > from_scale) { | 719 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 12 | } | 721 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 19 | sizeof(typename ToFieldType::NativeType)), | 723 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 19 | MaxNativeType scale_multiplier = | 725 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 19 | typename ToFieldType::NativeType max_result = | 727 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 19 | NullMap::value_type* null_map_data = nullptr; | 732 | 19 | if (narrow_integral) { | 733 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 15 | null_map_data = col_null_map_to->get_data().data(); | 735 | 15 | } | 736 | | | 737 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 19 | const auto& vec_from = col_from->get_data(); | 739 | 19 | const auto* vec_from_data = vec_from.data(); | 740 | 19 | auto& vec_to = col_to->get_data(); | 741 | 19 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 19 | CastParameters params; | 744 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 19 | size_t size = vec_from.size(); | 746 | | | 747 | 19 | RETURN_IF_ERROR(std::visit( | 748 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 19 | for (size_t i = 0; i < size; i++) { | 750 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 19 | typename ToDataType::FieldType, | 752 | 19 | multiply_may_overflow, narrow_integral>( | 753 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 19 | scale_multiplier, min_result, max_result, params)) { | 755 | 19 | if (set_nullable) { | 756 | 19 | null_map_data[i] = 1; | 757 | 19 | } else { | 758 | 19 | return params.status; | 759 | 19 | } | 760 | 19 | } | 761 | 19 | } | 762 | 19 | return Status::OK(); | 763 | 19 | }, | 764 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 3 | block.get_by_position(result).column = | 768 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 7 | return Status::OK(); | 773 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 10 | using FromFieldType = typename FromDataType::FieldType; | 689 | 10 | using ToFieldType = typename ToDataType::FieldType; | 690 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 10 | const auto* col_from = | 692 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 10 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 10 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 10 | ToDataType::check_type_precision(to_precision); | 705 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 10 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 10 | constexpr UInt32 to_max_digits = | 716 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 10 | bool multiply_may_overflow = false; | 718 | 10 | if (to_scale > from_scale) { | 719 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 6 | } | 721 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 10 | sizeof(typename ToFieldType::NativeType)), | 723 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 10 | MaxNativeType scale_multiplier = | 725 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 10 | typename ToFieldType::NativeType max_result = | 727 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 10 | NullMap::value_type* null_map_data = nullptr; | 732 | 10 | if (narrow_integral) { | 733 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 6 | null_map_data = col_null_map_to->get_data().data(); | 735 | 6 | } | 736 | | | 737 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 10 | const auto& vec_from = col_from->get_data(); | 739 | 10 | const auto* vec_from_data = vec_from.data(); | 740 | 10 | auto& vec_to = col_to->get_data(); | 741 | 10 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 10 | CastParameters params; | 744 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 10 | size_t size = vec_from.size(); | 746 | | | 747 | 10 | RETURN_IF_ERROR(std::visit( | 748 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 10 | for (size_t i = 0; i < size; i++) { | 750 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 10 | typename ToDataType::FieldType, | 752 | 10 | multiply_may_overflow, narrow_integral>( | 753 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 10 | scale_multiplier, min_result, max_result, params)) { | 755 | 10 | if (set_nullable) { | 756 | 10 | null_map_data[i] = 1; | 757 | 10 | } else { | 758 | 10 | return params.status; | 759 | 10 | } | 760 | 10 | } | 761 | 10 | } | 762 | 10 | return Status::OK(); | 763 | 10 | }, | 764 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 10 | if (narrow_integral) { | 767 | 6 | block.get_by_position(result).column = | 768 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 6 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 10 | return Status::OK(); | 773 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 19 | using FromFieldType = typename FromDataType::FieldType; | 689 | 19 | using ToFieldType = typename ToDataType::FieldType; | 690 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 19 | const auto* col_from = | 692 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 19 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 19 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 19 | ToDataType::check_type_precision(to_precision); | 705 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 19 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 19 | constexpr UInt32 to_max_digits = | 716 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 19 | bool multiply_may_overflow = false; | 718 | 19 | if (to_scale > from_scale) { | 719 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 12 | } | 721 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 19 | sizeof(typename ToFieldType::NativeType)), | 723 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 19 | MaxNativeType scale_multiplier = | 725 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 19 | typename ToFieldType::NativeType max_result = | 727 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 19 | NullMap::value_type* null_map_data = nullptr; | 732 | 19 | if (narrow_integral) { | 733 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 15 | null_map_data = col_null_map_to->get_data().data(); | 735 | 15 | } | 736 | | | 737 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 19 | const auto& vec_from = col_from->get_data(); | 739 | 19 | const auto* vec_from_data = vec_from.data(); | 740 | 19 | auto& vec_to = col_to->get_data(); | 741 | 19 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 19 | CastParameters params; | 744 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 19 | size_t size = vec_from.size(); | 746 | | | 747 | 19 | RETURN_IF_ERROR(std::visit( | 748 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 19 | for (size_t i = 0; i < size; i++) { | 750 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 19 | typename ToDataType::FieldType, | 752 | 19 | multiply_may_overflow, narrow_integral>( | 753 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 19 | scale_multiplier, min_result, max_result, params)) { | 755 | 19 | if (set_nullable) { | 756 | 19 | null_map_data[i] = 1; | 757 | 19 | } else { | 758 | 19 | return params.status; | 759 | 19 | } | 760 | 19 | } | 761 | 19 | } | 762 | 19 | return Status::OK(); | 763 | 19 | }, | 764 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 3 | block.get_by_position(result).column = | 768 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 7 | return Status::OK(); | 773 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 10 | using FromFieldType = typename FromDataType::FieldType; | 689 | 10 | using ToFieldType = typename ToDataType::FieldType; | 690 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 10 | const auto* col_from = | 692 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 10 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 10 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 10 | ToDataType::check_type_precision(to_precision); | 705 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 10 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 10 | constexpr UInt32 to_max_digits = | 716 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 10 | bool multiply_may_overflow = false; | 718 | 10 | if (to_scale > from_scale) { | 719 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 6 | } | 721 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 10 | sizeof(typename ToFieldType::NativeType)), | 723 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 10 | MaxNativeType scale_multiplier = | 725 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 10 | typename ToFieldType::NativeType max_result = | 727 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 10 | NullMap::value_type* null_map_data = nullptr; | 732 | 10 | if (narrow_integral) { | 733 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 6 | null_map_data = col_null_map_to->get_data().data(); | 735 | 6 | } | 736 | | | 737 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 10 | const auto& vec_from = col_from->get_data(); | 739 | 10 | const auto* vec_from_data = vec_from.data(); | 740 | 10 | auto& vec_to = col_to->get_data(); | 741 | 10 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 10 | CastParameters params; | 744 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 10 | size_t size = vec_from.size(); | 746 | | | 747 | 10 | RETURN_IF_ERROR(std::visit( | 748 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 10 | for (size_t i = 0; i < size; i++) { | 750 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 10 | typename ToDataType::FieldType, | 752 | 10 | multiply_may_overflow, narrow_integral>( | 753 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 10 | scale_multiplier, min_result, max_result, params)) { | 755 | 10 | if (set_nullable) { | 756 | 10 | null_map_data[i] = 1; | 757 | 10 | } else { | 758 | 10 | return params.status; | 759 | 10 | } | 760 | 10 | } | 761 | 10 | } | 762 | 10 | return Status::OK(); | 763 | 10 | }, | 764 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 10 | if (narrow_integral) { | 767 | 6 | block.get_by_position(result).column = | 768 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 6 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 10 | return Status::OK(); | 773 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 23 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 23 | using FromFieldType = typename FromDataType::FieldType; | 689 | 23 | using ToFieldType = typename ToDataType::FieldType; | 690 | 23 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 23 | const auto* col_from = | 692 | 23 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 23 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 23 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 23 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 23 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 23 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 23 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 23 | ToDataType::check_type_precision(to_precision); | 705 | 23 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 23 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 23 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 23 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 23 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 23 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 23 | constexpr UInt32 to_max_digits = | 716 | 23 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 23 | bool multiply_may_overflow = false; | 718 | 23 | if (to_scale > from_scale) { | 719 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 16 | } | 721 | 23 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 23 | sizeof(typename ToFieldType::NativeType)), | 723 | 23 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 23 | MaxNativeType scale_multiplier = | 725 | 23 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 23 | typename ToFieldType::NativeType max_result = | 727 | 23 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 23 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 23 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 23 | NullMap::value_type* null_map_data = nullptr; | 732 | 23 | if (narrow_integral) { | 733 | 20 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 20 | null_map_data = col_null_map_to->get_data().data(); | 735 | 20 | } | 736 | | | 737 | 23 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 23 | const auto& vec_from = col_from->get_data(); | 739 | 23 | const auto* vec_from_data = vec_from.data(); | 740 | 23 | auto& vec_to = col_to->get_data(); | 741 | 23 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 23 | CastParameters params; | 744 | 23 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 23 | size_t size = vec_from.size(); | 746 | | | 747 | 23 | RETURN_IF_ERROR(std::visit( | 748 | 23 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 23 | for (size_t i = 0; i < size; i++) { | 750 | 23 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 23 | typename ToDataType::FieldType, | 752 | 23 | multiply_may_overflow, narrow_integral>( | 753 | 23 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 23 | scale_multiplier, min_result, max_result, params)) { | 755 | 23 | if (set_nullable) { | 756 | 23 | null_map_data[i] = 1; | 757 | 23 | } else { | 758 | 23 | return params.status; | 759 | 23 | } | 760 | 23 | } | 761 | 23 | } | 762 | 23 | return Status::OK(); | 763 | 23 | }, | 764 | 23 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 4 | block.get_by_position(result).column = | 768 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 3 | block.get_by_position(result).column = std::move(col_to); | 771 | 3 | } | 772 | 7 | return Status::OK(); | 773 | 23 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 11 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 11 | using FromFieldType = typename FromDataType::FieldType; | 689 | 11 | using ToFieldType = typename ToDataType::FieldType; | 690 | 11 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 11 | const auto* col_from = | 692 | 11 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 11 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 11 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 11 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 11 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 11 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 11 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 11 | ToDataType::check_type_precision(to_precision); | 705 | 11 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 11 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 11 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 11 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 11 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 11 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 11 | constexpr UInt32 to_max_digits = | 716 | 11 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 11 | bool multiply_may_overflow = false; | 718 | 11 | if (to_scale > from_scale) { | 719 | 7 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 7 | } | 721 | 11 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 11 | sizeof(typename ToFieldType::NativeType)), | 723 | 11 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 11 | MaxNativeType scale_multiplier = | 725 | 11 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 11 | typename ToFieldType::NativeType max_result = | 727 | 11 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 11 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 11 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 11 | NullMap::value_type* null_map_data = nullptr; | 732 | 11 | if (narrow_integral) { | 733 | 8 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 8 | null_map_data = col_null_map_to->get_data().data(); | 735 | 8 | } | 736 | | | 737 | 11 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 11 | const auto& vec_from = col_from->get_data(); | 739 | 11 | const auto* vec_from_data = vec_from.data(); | 740 | 11 | auto& vec_to = col_to->get_data(); | 741 | 11 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 11 | CastParameters params; | 744 | 11 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 11 | size_t size = vec_from.size(); | 746 | | | 747 | 11 | RETURN_IF_ERROR(std::visit( | 748 | 11 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 11 | for (size_t i = 0; i < size; i++) { | 750 | 11 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 11 | typename ToDataType::FieldType, | 752 | 11 | multiply_may_overflow, narrow_integral>( | 753 | 11 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 11 | scale_multiplier, min_result, max_result, params)) { | 755 | 11 | if (set_nullable) { | 756 | 11 | null_map_data[i] = 1; | 757 | 11 | } else { | 758 | 11 | return params.status; | 759 | 11 | } | 760 | 11 | } | 761 | 11 | } | 762 | 11 | return Status::OK(); | 763 | 11 | }, | 764 | 11 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 11 | if (narrow_integral) { | 767 | 8 | block.get_by_position(result).column = | 768 | 8 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 8 | } else { | 770 | 3 | block.get_by_position(result).column = std::move(col_to); | 771 | 3 | } | 772 | 11 | return Status::OK(); | 773 | 11 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 35 | using FromFieldType = typename FromDataType::FieldType; | 689 | 35 | using ToFieldType = typename ToDataType::FieldType; | 690 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 35 | const auto* col_from = | 692 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 35 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 35 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 35 | ToDataType::check_type_precision(to_precision); | 705 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 35 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 35 | constexpr UInt32 to_max_digits = | 716 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 35 | bool multiply_may_overflow = false; | 718 | 35 | if (to_scale > from_scale) { | 719 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 20 | } | 721 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 35 | sizeof(typename ToFieldType::NativeType)), | 723 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 35 | MaxNativeType scale_multiplier = | 725 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 35 | typename ToFieldType::NativeType max_result = | 727 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 35 | NullMap::value_type* null_map_data = nullptr; | 732 | 35 | if (narrow_integral) { | 733 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 35 | null_map_data = col_null_map_to->get_data().data(); | 735 | 35 | } | 736 | | | 737 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 35 | const auto& vec_from = col_from->get_data(); | 739 | 35 | const auto* vec_from_data = vec_from.data(); | 740 | 35 | auto& vec_to = col_to->get_data(); | 741 | 35 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 35 | CastParameters params; | 744 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 35 | size_t size = vec_from.size(); | 746 | | | 747 | 35 | RETURN_IF_ERROR(std::visit( | 748 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 35 | for (size_t i = 0; i < size; i++) { | 750 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 35 | typename ToDataType::FieldType, | 752 | 35 | multiply_may_overflow, narrow_integral>( | 753 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 35 | scale_multiplier, min_result, max_result, params)) { | 755 | 35 | if (set_nullable) { | 756 | 35 | null_map_data[i] = 1; | 757 | 35 | } else { | 758 | 35 | return params.status; | 759 | 35 | } | 760 | 35 | } | 761 | 35 | } | 762 | 35 | return Status::OK(); | 763 | 35 | }, | 764 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 7 | block.get_by_position(result).column = | 768 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 7 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 7 | return Status::OK(); | 773 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 14 | using FromFieldType = typename FromDataType::FieldType; | 689 | 14 | using ToFieldType = typename ToDataType::FieldType; | 690 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 14 | const auto* col_from = | 692 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 14 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 14 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 14 | ToDataType::check_type_precision(to_precision); | 705 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 14 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 14 | constexpr UInt32 to_max_digits = | 716 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 14 | bool multiply_may_overflow = false; | 718 | 14 | if (to_scale > from_scale) { | 719 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 8 | } | 721 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 14 | sizeof(typename ToFieldType::NativeType)), | 723 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 14 | MaxNativeType scale_multiplier = | 725 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 14 | typename ToFieldType::NativeType max_result = | 727 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 14 | NullMap::value_type* null_map_data = nullptr; | 732 | 14 | if (narrow_integral) { | 733 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 14 | null_map_data = col_null_map_to->get_data().data(); | 735 | 14 | } | 736 | | | 737 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 14 | const auto& vec_from = col_from->get_data(); | 739 | 14 | const auto* vec_from_data = vec_from.data(); | 740 | 14 | auto& vec_to = col_to->get_data(); | 741 | 14 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 14 | CastParameters params; | 744 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 14 | size_t size = vec_from.size(); | 746 | | | 747 | 14 | RETURN_IF_ERROR(std::visit( | 748 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 14 | for (size_t i = 0; i < size; i++) { | 750 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 14 | typename ToDataType::FieldType, | 752 | 14 | multiply_may_overflow, narrow_integral>( | 753 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 14 | scale_multiplier, min_result, max_result, params)) { | 755 | 14 | if (set_nullable) { | 756 | 14 | null_map_data[i] = 1; | 757 | 14 | } else { | 758 | 14 | return params.status; | 759 | 14 | } | 760 | 14 | } | 761 | 14 | } | 762 | 14 | return Status::OK(); | 763 | 14 | }, | 764 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 14 | if (narrow_integral) { | 767 | 14 | block.get_by_position(result).column = | 768 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 14 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 14 | return Status::OK(); | 773 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 2 | using FromFieldType = typename FromDataType::FieldType; | 689 | 2 | using ToFieldType = typename ToDataType::FieldType; | 690 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 2 | const auto* col_from = | 692 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 2 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 2 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 2 | ToDataType::check_type_precision(to_precision); | 705 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 2 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 2 | constexpr UInt32 to_max_digits = | 716 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 2 | bool multiply_may_overflow = false; | 718 | 2 | if (to_scale > from_scale) { | 719 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 2 | } | 721 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 2 | sizeof(typename ToFieldType::NativeType)), | 723 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 2 | MaxNativeType scale_multiplier = | 725 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 2 | typename ToFieldType::NativeType max_result = | 727 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 2 | NullMap::value_type* null_map_data = nullptr; | 732 | 2 | if (narrow_integral) { | 733 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 2 | null_map_data = col_null_map_to->get_data().data(); | 735 | 2 | } | 736 | | | 737 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 2 | const auto& vec_from = col_from->get_data(); | 739 | 2 | const auto* vec_from_data = vec_from.data(); | 740 | 2 | auto& vec_to = col_to->get_data(); | 741 | 2 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 2 | CastParameters params; | 744 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 2 | size_t size = vec_from.size(); | 746 | | | 747 | 2 | RETURN_IF_ERROR(std::visit( | 748 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 2 | for (size_t i = 0; i < size; i++) { | 750 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 2 | typename ToDataType::FieldType, | 752 | 2 | multiply_may_overflow, narrow_integral>( | 753 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 2 | scale_multiplier, min_result, max_result, params)) { | 755 | 2 | if (set_nullable) { | 756 | 2 | null_map_data[i] = 1; | 757 | 2 | } else { | 758 | 2 | return params.status; | 759 | 2 | } | 760 | 2 | } | 761 | 2 | } | 762 | 2 | return Status::OK(); | 763 | 2 | }, | 764 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 1 | if (narrow_integral) { | 767 | 1 | block.get_by_position(result).column = | 768 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 1 | } else { | 770 | 0 | block.get_by_position(result).column = std::move(col_to); | 771 | 0 | } | 772 | 1 | return Status::OK(); | 773 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 5 | using FromFieldType = typename FromDataType::FieldType; | 689 | 5 | using ToFieldType = typename ToDataType::FieldType; | 690 | 5 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 5 | const auto* col_from = | 692 | 5 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 5 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 5 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 5 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 5 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 5 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 5 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 5 | ToDataType::check_type_precision(to_precision); | 705 | 5 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 5 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 5 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 5 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 5 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 5 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 5 | constexpr UInt32 to_max_digits = | 716 | 5 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 5 | bool multiply_may_overflow = false; | 718 | 5 | if (to_scale > from_scale) { | 719 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 4 | } | 721 | 5 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 5 | sizeof(typename ToFieldType::NativeType)), | 723 | 5 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 5 | MaxNativeType scale_multiplier = | 725 | 5 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 5 | typename ToFieldType::NativeType max_result = | 727 | 5 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 5 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 5 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 5 | NullMap::value_type* null_map_data = nullptr; | 732 | 5 | if (narrow_integral) { | 733 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 1 | null_map_data = col_null_map_to->get_data().data(); | 735 | 1 | } | 736 | | | 737 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 5 | const auto& vec_from = col_from->get_data(); | 739 | 5 | const auto* vec_from_data = vec_from.data(); | 740 | 5 | auto& vec_to = col_to->get_data(); | 741 | 5 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 5 | CastParameters params; | 744 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 5 | size_t size = vec_from.size(); | 746 | | | 747 | 5 | RETURN_IF_ERROR(std::visit( | 748 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 5 | for (size_t i = 0; i < size; i++) { | 750 | 5 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 5 | typename ToDataType::FieldType, | 752 | 5 | multiply_may_overflow, narrow_integral>( | 753 | 5 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 5 | scale_multiplier, min_result, max_result, params)) { | 755 | 5 | if (set_nullable) { | 756 | 5 | null_map_data[i] = 1; | 757 | 5 | } else { | 758 | 5 | return params.status; | 759 | 5 | } | 760 | 5 | } | 761 | 5 | } | 762 | 5 | return Status::OK(); | 763 | 5 | }, | 764 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 5 | if (narrow_integral) { | 767 | 1 | block.get_by_position(result).column = | 768 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 5 | return Status::OK(); | 773 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 19 | using FromFieldType = typename FromDataType::FieldType; | 689 | 19 | using ToFieldType = typename ToDataType::FieldType; | 690 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 19 | const auto* col_from = | 692 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 19 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 19 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 19 | ToDataType::check_type_precision(to_precision); | 705 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 19 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 19 | constexpr UInt32 to_max_digits = | 716 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 19 | bool multiply_may_overflow = false; | 718 | 19 | if (to_scale > from_scale) { | 719 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 12 | } | 721 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 19 | sizeof(typename ToFieldType::NativeType)), | 723 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 19 | MaxNativeType scale_multiplier = | 725 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 19 | typename ToFieldType::NativeType max_result = | 727 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 19 | NullMap::value_type* null_map_data = nullptr; | 732 | 19 | if (narrow_integral) { | 733 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 15 | null_map_data = col_null_map_to->get_data().data(); | 735 | 15 | } | 736 | | | 737 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 19 | const auto& vec_from = col_from->get_data(); | 739 | 19 | const auto* vec_from_data = vec_from.data(); | 740 | 19 | auto& vec_to = col_to->get_data(); | 741 | 19 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 19 | CastParameters params; | 744 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 19 | size_t size = vec_from.size(); | 746 | | | 747 | 19 | RETURN_IF_ERROR(std::visit( | 748 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 19 | for (size_t i = 0; i < size; i++) { | 750 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 19 | typename ToDataType::FieldType, | 752 | 19 | multiply_may_overflow, narrow_integral>( | 753 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 19 | scale_multiplier, min_result, max_result, params)) { | 755 | 19 | if (set_nullable) { | 756 | 19 | null_map_data[i] = 1; | 757 | 19 | } else { | 758 | 19 | return params.status; | 759 | 19 | } | 760 | 19 | } | 761 | 19 | } | 762 | 19 | return Status::OK(); | 763 | 19 | }, | 764 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 3 | block.get_by_position(result).column = | 768 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 7 | return Status::OK(); | 773 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 10 | using FromFieldType = typename FromDataType::FieldType; | 689 | 10 | using ToFieldType = typename ToDataType::FieldType; | 690 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 10 | const auto* col_from = | 692 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 10 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 10 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 10 | ToDataType::check_type_precision(to_precision); | 705 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 10 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 10 | constexpr UInt32 to_max_digits = | 716 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 10 | bool multiply_may_overflow = false; | 718 | 10 | if (to_scale > from_scale) { | 719 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 6 | } | 721 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 10 | sizeof(typename ToFieldType::NativeType)), | 723 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 10 | MaxNativeType scale_multiplier = | 725 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 10 | typename ToFieldType::NativeType max_result = | 727 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 10 | NullMap::value_type* null_map_data = nullptr; | 732 | 10 | if (narrow_integral) { | 733 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 6 | null_map_data = col_null_map_to->get_data().data(); | 735 | 6 | } | 736 | | | 737 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 10 | const auto& vec_from = col_from->get_data(); | 739 | 10 | const auto* vec_from_data = vec_from.data(); | 740 | 10 | auto& vec_to = col_to->get_data(); | 741 | 10 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 10 | CastParameters params; | 744 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 10 | size_t size = vec_from.size(); | 746 | | | 747 | 10 | RETURN_IF_ERROR(std::visit( | 748 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 10 | for (size_t i = 0; i < size; i++) { | 750 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 10 | typename ToDataType::FieldType, | 752 | 10 | multiply_may_overflow, narrow_integral>( | 753 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 10 | scale_multiplier, min_result, max_result, params)) { | 755 | 10 | if (set_nullable) { | 756 | 10 | null_map_data[i] = 1; | 757 | 10 | } else { | 758 | 10 | return params.status; | 759 | 10 | } | 760 | 10 | } | 761 | 10 | } | 762 | 10 | return Status::OK(); | 763 | 10 | }, | 764 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 10 | if (narrow_integral) { | 767 | 6 | block.get_by_position(result).column = | 768 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 6 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 10 | return Status::OK(); | 773 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 19 | using FromFieldType = typename FromDataType::FieldType; | 689 | 19 | using ToFieldType = typename ToDataType::FieldType; | 690 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 19 | const auto* col_from = | 692 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 19 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 19 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 19 | ToDataType::check_type_precision(to_precision); | 705 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 19 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 19 | constexpr UInt32 to_max_digits = | 716 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 19 | bool multiply_may_overflow = false; | 718 | 19 | if (to_scale > from_scale) { | 719 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 12 | } | 721 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 19 | sizeof(typename ToFieldType::NativeType)), | 723 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 19 | MaxNativeType scale_multiplier = | 725 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 19 | typename ToFieldType::NativeType max_result = | 727 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 19 | NullMap::value_type* null_map_data = nullptr; | 732 | 19 | if (narrow_integral) { | 733 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 15 | null_map_data = col_null_map_to->get_data().data(); | 735 | 15 | } | 736 | | | 737 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 19 | const auto& vec_from = col_from->get_data(); | 739 | 19 | const auto* vec_from_data = vec_from.data(); | 740 | 19 | auto& vec_to = col_to->get_data(); | 741 | 19 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 19 | CastParameters params; | 744 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 19 | size_t size = vec_from.size(); | 746 | | | 747 | 19 | RETURN_IF_ERROR(std::visit( | 748 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 19 | for (size_t i = 0; i < size; i++) { | 750 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 19 | typename ToDataType::FieldType, | 752 | 19 | multiply_may_overflow, narrow_integral>( | 753 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 19 | scale_multiplier, min_result, max_result, params)) { | 755 | 19 | if (set_nullable) { | 756 | 19 | null_map_data[i] = 1; | 757 | 19 | } else { | 758 | 19 | return params.status; | 759 | 19 | } | 760 | 19 | } | 761 | 19 | } | 762 | 19 | return Status::OK(); | 763 | 19 | }, | 764 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 3 | block.get_by_position(result).column = | 768 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 7 | return Status::OK(); | 773 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 10 | using FromFieldType = typename FromDataType::FieldType; | 689 | 10 | using ToFieldType = typename ToDataType::FieldType; | 690 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 10 | const auto* col_from = | 692 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 10 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 10 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 10 | ToDataType::check_type_precision(to_precision); | 705 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 10 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 10 | constexpr UInt32 to_max_digits = | 716 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 10 | bool multiply_may_overflow = false; | 718 | 10 | if (to_scale > from_scale) { | 719 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 6 | } | 721 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 10 | sizeof(typename ToFieldType::NativeType)), | 723 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 10 | MaxNativeType scale_multiplier = | 725 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 10 | typename ToFieldType::NativeType max_result = | 727 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 10 | NullMap::value_type* null_map_data = nullptr; | 732 | 10 | if (narrow_integral) { | 733 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 6 | null_map_data = col_null_map_to->get_data().data(); | 735 | 6 | } | 736 | | | 737 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 10 | const auto& vec_from = col_from->get_data(); | 739 | 10 | const auto* vec_from_data = vec_from.data(); | 740 | 10 | auto& vec_to = col_to->get_data(); | 741 | 10 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 10 | CastParameters params; | 744 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 10 | size_t size = vec_from.size(); | 746 | | | 747 | 10 | RETURN_IF_ERROR(std::visit( | 748 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 10 | for (size_t i = 0; i < size; i++) { | 750 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 10 | typename ToDataType::FieldType, | 752 | 10 | multiply_may_overflow, narrow_integral>( | 753 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 10 | scale_multiplier, min_result, max_result, params)) { | 755 | 10 | if (set_nullable) { | 756 | 10 | null_map_data[i] = 1; | 757 | 10 | } else { | 758 | 10 | return params.status; | 759 | 10 | } | 760 | 10 | } | 761 | 10 | } | 762 | 10 | return Status::OK(); | 763 | 10 | }, | 764 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 10 | if (narrow_integral) { | 767 | 6 | block.get_by_position(result).column = | 768 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 6 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 10 | return Status::OK(); | 773 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 19 | using FromFieldType = typename FromDataType::FieldType; | 689 | 19 | using ToFieldType = typename ToDataType::FieldType; | 690 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 19 | const auto* col_from = | 692 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 19 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 19 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 19 | ToDataType::check_type_precision(to_precision); | 705 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 19 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 19 | constexpr UInt32 to_max_digits = | 716 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 19 | bool multiply_may_overflow = false; | 718 | 19 | if (to_scale > from_scale) { | 719 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 12 | } | 721 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 19 | sizeof(typename ToFieldType::NativeType)), | 723 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 19 | MaxNativeType scale_multiplier = | 725 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 19 | typename ToFieldType::NativeType max_result = | 727 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 19 | NullMap::value_type* null_map_data = nullptr; | 732 | 19 | if (narrow_integral) { | 733 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 15 | null_map_data = col_null_map_to->get_data().data(); | 735 | 15 | } | 736 | | | 737 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 19 | const auto& vec_from = col_from->get_data(); | 739 | 19 | const auto* vec_from_data = vec_from.data(); | 740 | 19 | auto& vec_to = col_to->get_data(); | 741 | 19 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 19 | CastParameters params; | 744 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 19 | size_t size = vec_from.size(); | 746 | | | 747 | 19 | RETURN_IF_ERROR(std::visit( | 748 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 19 | for (size_t i = 0; i < size; i++) { | 750 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 19 | typename ToDataType::FieldType, | 752 | 19 | multiply_may_overflow, narrow_integral>( | 753 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 19 | scale_multiplier, min_result, max_result, params)) { | 755 | 19 | if (set_nullable) { | 756 | 19 | null_map_data[i] = 1; | 757 | 19 | } else { | 758 | 19 | return params.status; | 759 | 19 | } | 760 | 19 | } | 761 | 19 | } | 762 | 19 | return Status::OK(); | 763 | 19 | }, | 764 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 3 | block.get_by_position(result).column = | 768 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 7 | return Status::OK(); | 773 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 10 | using FromFieldType = typename FromDataType::FieldType; | 689 | 10 | using ToFieldType = typename ToDataType::FieldType; | 690 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 10 | const auto* col_from = | 692 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 10 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 10 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 10 | ToDataType::check_type_precision(to_precision); | 705 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 10 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 10 | constexpr UInt32 to_max_digits = | 716 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 10 | bool multiply_may_overflow = false; | 718 | 10 | if (to_scale > from_scale) { | 719 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 6 | } | 721 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 10 | sizeof(typename ToFieldType::NativeType)), | 723 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 10 | MaxNativeType scale_multiplier = | 725 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 10 | typename ToFieldType::NativeType max_result = | 727 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 10 | NullMap::value_type* null_map_data = nullptr; | 732 | 10 | if (narrow_integral) { | 733 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 6 | null_map_data = col_null_map_to->get_data().data(); | 735 | 6 | } | 736 | | | 737 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 10 | const auto& vec_from = col_from->get_data(); | 739 | 10 | const auto* vec_from_data = vec_from.data(); | 740 | 10 | auto& vec_to = col_to->get_data(); | 741 | 10 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 10 | CastParameters params; | 744 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 10 | size_t size = vec_from.size(); | 746 | | | 747 | 10 | RETURN_IF_ERROR(std::visit( | 748 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 10 | for (size_t i = 0; i < size; i++) { | 750 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 10 | typename ToDataType::FieldType, | 752 | 10 | multiply_may_overflow, narrow_integral>( | 753 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 10 | scale_multiplier, min_result, max_result, params)) { | 755 | 10 | if (set_nullable) { | 756 | 10 | null_map_data[i] = 1; | 757 | 10 | } else { | 758 | 10 | return params.status; | 759 | 10 | } | 760 | 10 | } | 761 | 10 | } | 762 | 10 | return Status::OK(); | 763 | 10 | }, | 764 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 10 | if (narrow_integral) { | 767 | 6 | block.get_by_position(result).column = | 768 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 6 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 10 | return Status::OK(); | 773 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 19 | using FromFieldType = typename FromDataType::FieldType; | 689 | 19 | using ToFieldType = typename ToDataType::FieldType; | 690 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 19 | const auto* col_from = | 692 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 19 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 19 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 19 | ToDataType::check_type_precision(to_precision); | 705 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 19 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 19 | constexpr UInt32 to_max_digits = | 716 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 19 | bool multiply_may_overflow = false; | 718 | 19 | if (to_scale > from_scale) { | 719 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 12 | } | 721 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 19 | sizeof(typename ToFieldType::NativeType)), | 723 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 19 | MaxNativeType scale_multiplier = | 725 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 19 | typename ToFieldType::NativeType max_result = | 727 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 19 | NullMap::value_type* null_map_data = nullptr; | 732 | 19 | if (narrow_integral) { | 733 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 15 | null_map_data = col_null_map_to->get_data().data(); | 735 | 15 | } | 736 | | | 737 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 19 | const auto& vec_from = col_from->get_data(); | 739 | 19 | const auto* vec_from_data = vec_from.data(); | 740 | 19 | auto& vec_to = col_to->get_data(); | 741 | 19 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 19 | CastParameters params; | 744 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 19 | size_t size = vec_from.size(); | 746 | | | 747 | 19 | RETURN_IF_ERROR(std::visit( | 748 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 19 | for (size_t i = 0; i < size; i++) { | 750 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 19 | typename ToDataType::FieldType, | 752 | 19 | multiply_may_overflow, narrow_integral>( | 753 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 19 | scale_multiplier, min_result, max_result, params)) { | 755 | 19 | if (set_nullable) { | 756 | 19 | null_map_data[i] = 1; | 757 | 19 | } else { | 758 | 19 | return params.status; | 759 | 19 | } | 760 | 19 | } | 761 | 19 | } | 762 | 19 | return Status::OK(); | 763 | 19 | }, | 764 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 3 | block.get_by_position(result).column = | 768 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 4 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 7 | return Status::OK(); | 773 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 10 | using FromFieldType = typename FromDataType::FieldType; | 689 | 10 | using ToFieldType = typename ToDataType::FieldType; | 690 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 10 | const auto* col_from = | 692 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 10 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 10 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 10 | ToDataType::check_type_precision(to_precision); | 705 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 10 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 10 | constexpr UInt32 to_max_digits = | 716 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 10 | bool multiply_may_overflow = false; | 718 | 10 | if (to_scale > from_scale) { | 719 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 6 | } | 721 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 10 | sizeof(typename ToFieldType::NativeType)), | 723 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 10 | MaxNativeType scale_multiplier = | 725 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 10 | typename ToFieldType::NativeType max_result = | 727 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 10 | NullMap::value_type* null_map_data = nullptr; | 732 | 10 | if (narrow_integral) { | 733 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 6 | null_map_data = col_null_map_to->get_data().data(); | 735 | 6 | } | 736 | | | 737 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 10 | const auto& vec_from = col_from->get_data(); | 739 | 10 | const auto* vec_from_data = vec_from.data(); | 740 | 10 | auto& vec_to = col_to->get_data(); | 741 | 10 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 10 | CastParameters params; | 744 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 10 | size_t size = vec_from.size(); | 746 | | | 747 | 10 | RETURN_IF_ERROR(std::visit( | 748 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 10 | for (size_t i = 0; i < size; i++) { | 750 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 10 | typename ToDataType::FieldType, | 752 | 10 | multiply_may_overflow, narrow_integral>( | 753 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 10 | scale_multiplier, min_result, max_result, params)) { | 755 | 10 | if (set_nullable) { | 756 | 10 | null_map_data[i] = 1; | 757 | 10 | } else { | 758 | 10 | return params.status; | 759 | 10 | } | 760 | 10 | } | 761 | 10 | } | 762 | 10 | return Status::OK(); | 763 | 10 | }, | 764 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 10 | if (narrow_integral) { | 767 | 6 | block.get_by_position(result).column = | 768 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 6 | } else { | 770 | 4 | block.get_by_position(result).column = std::move(col_to); | 771 | 4 | } | 772 | 10 | return Status::OK(); | 773 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 31 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 31 | using FromFieldType = typename FromDataType::FieldType; | 689 | 31 | using ToFieldType = typename ToDataType::FieldType; | 690 | 31 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 31 | const auto* col_from = | 692 | 31 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 31 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 31 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 31 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 31 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 31 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 31 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 31 | ToDataType::check_type_precision(to_precision); | 705 | 31 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 31 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 31 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 31 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 31 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 31 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 31 | constexpr UInt32 to_max_digits = | 716 | 31 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 31 | bool multiply_may_overflow = false; | 718 | 31 | if (to_scale > from_scale) { | 719 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 20 | } | 721 | 31 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 31 | sizeof(typename ToFieldType::NativeType)), | 723 | 31 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 31 | MaxNativeType scale_multiplier = | 725 | 31 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 31 | typename ToFieldType::NativeType max_result = | 727 | 31 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 31 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 31 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 31 | NullMap::value_type* null_map_data = nullptr; | 732 | 31 | if (narrow_integral) { | 733 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 30 | null_map_data = col_null_map_to->get_data().data(); | 735 | 30 | } | 736 | | | 737 | 31 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 31 | const auto& vec_from = col_from->get_data(); | 739 | 31 | const auto* vec_from_data = vec_from.data(); | 740 | 31 | auto& vec_to = col_to->get_data(); | 741 | 31 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 31 | CastParameters params; | 744 | 31 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 31 | size_t size = vec_from.size(); | 746 | | | 747 | 31 | RETURN_IF_ERROR(std::visit( | 748 | 31 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 31 | for (size_t i = 0; i < size; i++) { | 750 | 31 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 31 | typename ToDataType::FieldType, | 752 | 31 | multiply_may_overflow, narrow_integral>( | 753 | 31 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 31 | scale_multiplier, min_result, max_result, params)) { | 755 | 31 | if (set_nullable) { | 756 | 31 | null_map_data[i] = 1; | 757 | 31 | } else { | 758 | 31 | return params.status; | 759 | 31 | } | 760 | 31 | } | 761 | 31 | } | 762 | 31 | return Status::OK(); | 763 | 31 | }, | 764 | 31 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 7 | if (narrow_integral) { | 767 | 6 | block.get_by_position(result).column = | 768 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 6 | } else { | 770 | 1 | block.get_by_position(result).column = std::move(col_to); | 771 | 1 | } | 772 | 7 | return Status::OK(); | 773 | 31 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 687 | 13 | const NullMap::value_type* null_map = nullptr) const override { | 688 | 13 | using FromFieldType = typename FromDataType::FieldType; | 689 | 13 | using ToFieldType = typename ToDataType::FieldType; | 690 | 13 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 691 | 13 | const auto* col_from = | 692 | 13 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 693 | 13 | if (!col_from) { | 694 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 695 | 0 | named_from.column->get_name()); | 696 | 0 | } | 697 | | | 698 | 13 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 699 | 13 | constexpr UInt32 from_scale = 0; | 700 | | | 701 | 13 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 702 | 13 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 703 | 13 | UInt32 to_precision = to_decimal_type.get_precision(); | 704 | 13 | ToDataType::check_type_precision(to_precision); | 705 | 13 | UInt32 to_scale = to_decimal_type.get_scale(); | 706 | 13 | ToDataType::check_type_scale(to_scale); | 707 | | | 708 | 13 | auto from_max_int_digit_count = from_precision - from_scale; | 709 | 13 | auto to_max_int_digit_count = to_precision - to_scale; | 710 | | // may overflow. nullable result column. | 711 | 13 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 712 | | // only in non-strict mode and may overflow, we set nullable | 713 | 13 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 714 | | | 715 | 13 | constexpr UInt32 to_max_digits = | 716 | 13 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 717 | 13 | bool multiply_may_overflow = false; | 718 | 13 | if (to_scale > from_scale) { | 719 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 720 | 8 | } | 721 | 13 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 722 | 13 | sizeof(typename ToFieldType::NativeType)), | 723 | 13 | FromFieldType, typename ToFieldType::NativeType>; | 724 | 13 | MaxNativeType scale_multiplier = | 725 | 13 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 726 | 13 | typename ToFieldType::NativeType max_result = | 727 | 13 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 728 | 13 | typename ToFieldType::NativeType min_result = -max_result; | 729 | | | 730 | 13 | ColumnUInt8::MutablePtr col_null_map_to; | 731 | 13 | NullMap::value_type* null_map_data = nullptr; | 732 | 13 | if (narrow_integral) { | 733 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 734 | 12 | null_map_data = col_null_map_to->get_data().data(); | 735 | 12 | } | 736 | | | 737 | 13 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 738 | 13 | const auto& vec_from = col_from->get_data(); | 739 | 13 | const auto* vec_from_data = vec_from.data(); | 740 | 13 | auto& vec_to = col_to->get_data(); | 741 | 13 | auto* vec_to_data = vec_to.data(); | 742 | | | 743 | 13 | CastParameters params; | 744 | 13 | params.is_strict = (CastMode == CastModeType::StrictMode); | 745 | 13 | size_t size = vec_from.size(); | 746 | | | 747 | 13 | RETURN_IF_ERROR(std::visit( | 748 | 13 | [&](auto multiply_may_overflow, auto narrow_integral) { | 749 | 13 | for (size_t i = 0; i < size; i++) { | 750 | 13 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 751 | 13 | typename ToDataType::FieldType, | 752 | 13 | multiply_may_overflow, narrow_integral>( | 753 | 13 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 754 | 13 | scale_multiplier, min_result, max_result, params)) { | 755 | 13 | if (set_nullable) { | 756 | 13 | null_map_data[i] = 1; | 757 | 13 | } else { | 758 | 13 | return params.status; | 759 | 13 | } | 760 | 13 | } | 761 | 13 | } | 762 | 13 | return Status::OK(); | 763 | 13 | }, | 764 | 13 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 765 | | | 766 | 13 | if (narrow_integral) { | 767 | 12 | block.get_by_position(result).column = | 768 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 769 | 12 | } else { | 770 | 1 | block.get_by_position(result).column = std::move(col_to); | 771 | 1 | } | 772 | 13 | return Status::OK(); | 773 | 13 | } |
|
774 | | }; |
775 | | |
776 | | // cast float and double to decimal. ALWAYS nullable result column. |
777 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
778 | | requires(IsDataTypeDecimal<ToDataType> && IsDataTypeFloat<FromDataType>) |
779 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
780 | | public: |
781 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
782 | | uint32_t result, size_t input_rows_count, |
783 | 784 | const NullMap::value_type* null_map = nullptr) const override { |
784 | 784 | using FromFieldType = typename FromDataType::FieldType; |
785 | 784 | using ToFieldType = typename ToDataType::FieldType; |
786 | 784 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
787 | 784 | const auto* col_from = |
788 | 784 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
789 | 784 | if (!col_from) { |
790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
791 | 0 | named_from.column->get_name()); |
792 | 0 | } |
793 | | |
794 | 784 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); |
795 | 784 | UInt32 from_scale = 0; |
796 | | |
797 | 784 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
798 | 784 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
799 | 784 | UInt32 to_precision = to_decimal_type.get_precision(); |
800 | 784 | ToDataType::check_type_precision(to_precision); |
801 | 784 | UInt32 to_scale = to_decimal_type.get_scale(); |
802 | 784 | ToDataType::check_type_scale(to_scale); |
803 | | |
804 | 784 | auto from_max_int_digit_count = from_precision - from_scale; |
805 | 784 | auto to_max_int_digit_count = to_precision - to_scale; |
806 | 784 | bool narrow_integral = |
807 | 784 | (to_max_int_digit_count < from_max_int_digit_count) || |
808 | 784 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
809 | | // only in non-strict mode and may overflow, we set nullable |
810 | 784 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
811 | | |
812 | 784 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); |
813 | 784 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); |
814 | | |
815 | 784 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); |
816 | 784 | const auto& vec_from = col_from->get_data(); |
817 | 784 | const auto* vec_from_data = vec_from.data(); |
818 | 784 | auto& vec_to = col_to->get_data(); |
819 | 784 | auto* vec_to_data = vec_to.data(); |
820 | | |
821 | 784 | CastParameters params; |
822 | 784 | params.is_strict = (CastMode == CastModeType::StrictMode); |
823 | 784 | size_t size = vec_from.size(); |
824 | | |
825 | 784 | typename ToFieldType::NativeType scale_multiplier = |
826 | 784 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); |
827 | 784 | typename ToFieldType::NativeType max_result = |
828 | 784 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
829 | 784 | typename ToFieldType::NativeType min_result = -max_result; |
830 | 3.99k | for (size_t i = 0; i < size; i++) { |
831 | 3.35k | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, |
832 | 3.35k | typename ToDataType::FieldType>( |
833 | 3.35k | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, |
834 | 3.35k | min_result, max_result, params)) { |
835 | 288 | if (set_nullable) { |
836 | 144 | null_map_data[i] = 1; |
837 | 144 | } else { |
838 | 144 | return params.status; |
839 | 144 | } |
840 | 288 | } |
841 | 3.35k | } |
842 | | |
843 | 640 | block.get_by_position(result).column = |
844 | 640 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
845 | 640 | return Status::OK(); |
846 | 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 | 783 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 18 | using FromFieldType = typename FromDataType::FieldType; | 785 | 18 | using ToFieldType = typename ToDataType::FieldType; | 786 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 18 | const auto* col_from = | 788 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 18 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 18 | UInt32 from_scale = 0; | 796 | | | 797 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 18 | ToDataType::check_type_precision(to_precision); | 801 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 18 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 18 | bool narrow_integral = | 807 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 18 | const auto& vec_from = col_from->get_data(); | 817 | 18 | const auto* vec_from_data = vec_from.data(); | 818 | 18 | auto& vec_to = col_to->get_data(); | 819 | 18 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 18 | CastParameters params; | 822 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 18 | size_t size = vec_from.size(); | 824 | | | 825 | 18 | typename ToFieldType::NativeType scale_multiplier = | 826 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 18 | typename ToFieldType::NativeType max_result = | 828 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 18 | for (size_t i = 0; i < size; i++) { | 831 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 18 | typename ToDataType::FieldType>( | 833 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 18 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 0 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 18 | return params.status; | 839 | 18 | } | 840 | 18 | } | 841 | 18 | } | 842 | | | 843 | 0 | block.get_by_position(result).column = | 844 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 0 | return Status::OK(); | 846 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 81 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 81 | using FromFieldType = typename FromDataType::FieldType; | 785 | 81 | using ToFieldType = typename ToDataType::FieldType; | 786 | 81 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 81 | const auto* col_from = | 788 | 81 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 81 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 81 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 81 | UInt32 from_scale = 0; | 796 | | | 797 | 81 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 81 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 81 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 81 | ToDataType::check_type_precision(to_precision); | 801 | 81 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 81 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 81 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 81 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 81 | bool narrow_integral = | 807 | 81 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 81 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 81 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 81 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 81 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 81 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 81 | const auto& vec_from = col_from->get_data(); | 817 | 81 | const auto* vec_from_data = vec_from.data(); | 818 | 81 | auto& vec_to = col_to->get_data(); | 819 | 81 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 81 | CastParameters params; | 822 | 81 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 81 | size_t size = vec_from.size(); | 824 | | | 825 | 81 | typename ToFieldType::NativeType scale_multiplier = | 826 | 81 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 81 | typename ToFieldType::NativeType max_result = | 828 | 81 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 81 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 491 | for (size_t i = 0; i < size; i++) { | 831 | 410 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 410 | typename ToDataType::FieldType>( | 833 | 410 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 410 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 18 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 0 | return params.status; | 839 | 0 | } | 840 | 18 | } | 841 | 410 | } | 842 | | | 843 | 81 | block.get_by_position(result).column = | 844 | 81 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 81 | return Status::OK(); | 846 | 81 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 18 | using FromFieldType = typename FromDataType::FieldType; | 785 | 18 | using ToFieldType = typename ToDataType::FieldType; | 786 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 18 | const auto* col_from = | 788 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 18 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 18 | UInt32 from_scale = 0; | 796 | | | 797 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 18 | ToDataType::check_type_precision(to_precision); | 801 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 18 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 18 | bool narrow_integral = | 807 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 18 | const auto& vec_from = col_from->get_data(); | 817 | 18 | const auto* vec_from_data = vec_from.data(); | 818 | 18 | auto& vec_to = col_to->get_data(); | 819 | 18 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 18 | CastParameters params; | 822 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 18 | size_t size = vec_from.size(); | 824 | | | 825 | 18 | typename ToFieldType::NativeType scale_multiplier = | 826 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 18 | typename ToFieldType::NativeType max_result = | 828 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 18 | for (size_t i = 0; i < size; i++) { | 831 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 18 | typename ToDataType::FieldType>( | 833 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 18 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 0 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 18 | return params.status; | 839 | 18 | } | 840 | 18 | } | 841 | 18 | } | 842 | | | 843 | 0 | block.get_by_position(result).column = | 844 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 0 | return Status::OK(); | 846 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 85 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 85 | using FromFieldType = typename FromDataType::FieldType; | 785 | 85 | using ToFieldType = typename ToDataType::FieldType; | 786 | 85 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 85 | const auto* col_from = | 788 | 85 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 85 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 85 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 85 | UInt32 from_scale = 0; | 796 | | | 797 | 85 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 85 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 85 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 85 | ToDataType::check_type_precision(to_precision); | 801 | 85 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 85 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 85 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 85 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 85 | bool narrow_integral = | 807 | 85 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 85 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 85 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 85 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 85 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 85 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 85 | const auto& vec_from = col_from->get_data(); | 817 | 85 | const auto* vec_from_data = vec_from.data(); | 818 | 85 | auto& vec_to = col_to->get_data(); | 819 | 85 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 85 | CastParameters params; | 822 | 85 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 85 | size_t size = vec_from.size(); | 824 | | | 825 | 85 | typename ToFieldType::NativeType scale_multiplier = | 826 | 85 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 85 | typename ToFieldType::NativeType max_result = | 828 | 85 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 85 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 507 | for (size_t i = 0; i < size; i++) { | 831 | 422 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 422 | typename ToDataType::FieldType>( | 833 | 422 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 422 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 18 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 0 | return params.status; | 839 | 0 | } | 840 | 18 | } | 841 | 422 | } | 842 | | | 843 | 85 | block.get_by_position(result).column = | 844 | 85 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 85 | return Status::OK(); | 846 | 85 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 18 | using FromFieldType = typename FromDataType::FieldType; | 785 | 18 | using ToFieldType = typename ToDataType::FieldType; | 786 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 18 | const auto* col_from = | 788 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 18 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 18 | UInt32 from_scale = 0; | 796 | | | 797 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 18 | ToDataType::check_type_precision(to_precision); | 801 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 18 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 18 | bool narrow_integral = | 807 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 18 | const auto& vec_from = col_from->get_data(); | 817 | 18 | const auto* vec_from_data = vec_from.data(); | 818 | 18 | auto& vec_to = col_to->get_data(); | 819 | 18 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 18 | CastParameters params; | 822 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 18 | size_t size = vec_from.size(); | 824 | | | 825 | 18 | typename ToFieldType::NativeType scale_multiplier = | 826 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 18 | typename ToFieldType::NativeType max_result = | 828 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 18 | for (size_t i = 0; i < size; i++) { | 831 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 18 | typename ToDataType::FieldType>( | 833 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 18 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 0 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 18 | return params.status; | 839 | 18 | } | 840 | 18 | } | 841 | 18 | } | 842 | | | 843 | 0 | block.get_by_position(result).column = | 844 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 0 | return Status::OK(); | 846 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 81 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 81 | using FromFieldType = typename FromDataType::FieldType; | 785 | 81 | using ToFieldType = typename ToDataType::FieldType; | 786 | 81 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 81 | const auto* col_from = | 788 | 81 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 81 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 81 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 81 | UInt32 from_scale = 0; | 796 | | | 797 | 81 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 81 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 81 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 81 | ToDataType::check_type_precision(to_precision); | 801 | 81 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 81 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 81 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 81 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 81 | bool narrow_integral = | 807 | 81 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 81 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 81 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 81 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 81 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 81 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 81 | const auto& vec_from = col_from->get_data(); | 817 | 81 | const auto* vec_from_data = vec_from.data(); | 818 | 81 | auto& vec_to = col_to->get_data(); | 819 | 81 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 81 | CastParameters params; | 822 | 81 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 81 | size_t size = vec_from.size(); | 824 | | | 825 | 81 | typename ToFieldType::NativeType scale_multiplier = | 826 | 81 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 81 | typename ToFieldType::NativeType max_result = | 828 | 81 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 81 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 443 | for (size_t i = 0; i < size; i++) { | 831 | 362 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 362 | typename ToDataType::FieldType>( | 833 | 362 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 362 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 18 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 0 | return params.status; | 839 | 0 | } | 840 | 18 | } | 841 | 362 | } | 842 | | | 843 | 81 | block.get_by_position(result).column = | 844 | 81 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 81 | return Status::OK(); | 846 | 81 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 18 | using FromFieldType = typename FromDataType::FieldType; | 785 | 18 | using ToFieldType = typename ToDataType::FieldType; | 786 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 18 | const auto* col_from = | 788 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 18 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 18 | UInt32 from_scale = 0; | 796 | | | 797 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 18 | ToDataType::check_type_precision(to_precision); | 801 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 18 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 18 | bool narrow_integral = | 807 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 18 | const auto& vec_from = col_from->get_data(); | 817 | 18 | const auto* vec_from_data = vec_from.data(); | 818 | 18 | auto& vec_to = col_to->get_data(); | 819 | 18 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 18 | CastParameters params; | 822 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 18 | size_t size = vec_from.size(); | 824 | | | 825 | 18 | typename ToFieldType::NativeType scale_multiplier = | 826 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 18 | typename ToFieldType::NativeType max_result = | 828 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 18 | for (size_t i = 0; i < size; i++) { | 831 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 18 | typename ToDataType::FieldType>( | 833 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 18 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 0 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 18 | return params.status; | 839 | 18 | } | 840 | 18 | } | 841 | 18 | } | 842 | | | 843 | 0 | block.get_by_position(result).column = | 844 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 0 | return Status::OK(); | 846 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 81 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 81 | using FromFieldType = typename FromDataType::FieldType; | 785 | 81 | using ToFieldType = typename ToDataType::FieldType; | 786 | 81 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 81 | const auto* col_from = | 788 | 81 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 81 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 81 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 81 | UInt32 from_scale = 0; | 796 | | | 797 | 81 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 81 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 81 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 81 | ToDataType::check_type_precision(to_precision); | 801 | 81 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 81 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 81 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 81 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 81 | bool narrow_integral = | 807 | 81 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 81 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 81 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 81 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 81 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 81 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 81 | const auto& vec_from = col_from->get_data(); | 817 | 81 | const auto* vec_from_data = vec_from.data(); | 818 | 81 | auto& vec_to = col_to->get_data(); | 819 | 81 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 81 | CastParameters params; | 822 | 81 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 81 | size_t size = vec_from.size(); | 824 | | | 825 | 81 | typename ToFieldType::NativeType scale_multiplier = | 826 | 81 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 81 | typename ToFieldType::NativeType max_result = | 828 | 81 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 81 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 491 | for (size_t i = 0; i < size; i++) { | 831 | 410 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 410 | typename ToDataType::FieldType>( | 833 | 410 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 410 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 18 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 0 | return params.status; | 839 | 0 | } | 840 | 18 | } | 841 | 410 | } | 842 | | | 843 | 81 | block.get_by_position(result).column = | 844 | 81 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 81 | return Status::OK(); | 846 | 81 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 18 | using FromFieldType = typename FromDataType::FieldType; | 785 | 18 | using ToFieldType = typename ToDataType::FieldType; | 786 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 18 | const auto* col_from = | 788 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 18 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 18 | UInt32 from_scale = 0; | 796 | | | 797 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 18 | ToDataType::check_type_precision(to_precision); | 801 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 18 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 18 | bool narrow_integral = | 807 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 18 | const auto& vec_from = col_from->get_data(); | 817 | 18 | const auto* vec_from_data = vec_from.data(); | 818 | 18 | auto& vec_to = col_to->get_data(); | 819 | 18 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 18 | CastParameters params; | 822 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 18 | size_t size = vec_from.size(); | 824 | | | 825 | 18 | typename ToFieldType::NativeType scale_multiplier = | 826 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 18 | typename ToFieldType::NativeType max_result = | 828 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 18 | for (size_t i = 0; i < size; i++) { | 831 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 18 | typename ToDataType::FieldType>( | 833 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 18 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 0 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 18 | return params.status; | 839 | 18 | } | 840 | 18 | } | 841 | 18 | } | 842 | | | 843 | 0 | block.get_by_position(result).column = | 844 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 0 | return Status::OK(); | 846 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 89 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 89 | using FromFieldType = typename FromDataType::FieldType; | 785 | 89 | using ToFieldType = typename ToDataType::FieldType; | 786 | 89 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 89 | const auto* col_from = | 788 | 89 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 89 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 89 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 89 | UInt32 from_scale = 0; | 796 | | | 797 | 89 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 89 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 89 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 89 | ToDataType::check_type_precision(to_precision); | 801 | 89 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 89 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 89 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 89 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 89 | bool narrow_integral = | 807 | 89 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 89 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 89 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 89 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 89 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 89 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 89 | const auto& vec_from = col_from->get_data(); | 817 | 89 | const auto* vec_from_data = vec_from.data(); | 818 | 89 | auto& vec_to = col_to->get_data(); | 819 | 89 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 89 | CastParameters params; | 822 | 89 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 89 | size_t size = vec_from.size(); | 824 | | | 825 | 89 | typename ToFieldType::NativeType scale_multiplier = | 826 | 89 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 89 | typename ToFieldType::NativeType max_result = | 828 | 89 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 89 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 515 | for (size_t i = 0; i < size; i++) { | 831 | 426 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 426 | typename ToDataType::FieldType>( | 833 | 426 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 426 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 18 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 0 | return params.status; | 839 | 0 | } | 840 | 18 | } | 841 | 426 | } | 842 | | | 843 | 89 | block.get_by_position(result).column = | 844 | 89 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 89 | return Status::OK(); | 846 | 89 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 18 | using FromFieldType = typename FromDataType::FieldType; | 785 | 18 | using ToFieldType = typename ToDataType::FieldType; | 786 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 18 | const auto* col_from = | 788 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 18 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 18 | UInt32 from_scale = 0; | 796 | | | 797 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 18 | ToDataType::check_type_precision(to_precision); | 801 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 18 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 18 | bool narrow_integral = | 807 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 18 | const auto& vec_from = col_from->get_data(); | 817 | 18 | const auto* vec_from_data = vec_from.data(); | 818 | 18 | auto& vec_to = col_to->get_data(); | 819 | 18 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 18 | CastParameters params; | 822 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 18 | size_t size = vec_from.size(); | 824 | | | 825 | 18 | typename ToFieldType::NativeType scale_multiplier = | 826 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 18 | typename ToFieldType::NativeType max_result = | 828 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 18 | for (size_t i = 0; i < size; i++) { | 831 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 18 | typename ToDataType::FieldType>( | 833 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 18 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 0 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 18 | return params.status; | 839 | 18 | } | 840 | 18 | } | 841 | 18 | } | 842 | | | 843 | 0 | block.get_by_position(result).column = | 844 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 0 | return Status::OK(); | 846 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 73 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 73 | using FromFieldType = typename FromDataType::FieldType; | 785 | 73 | using ToFieldType = typename ToDataType::FieldType; | 786 | 73 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 73 | const auto* col_from = | 788 | 73 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 73 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 73 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 73 | UInt32 from_scale = 0; | 796 | | | 797 | 73 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 73 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 73 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 73 | ToDataType::check_type_precision(to_precision); | 801 | 73 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 73 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 73 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 73 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 73 | bool narrow_integral = | 807 | 73 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 73 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 73 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 73 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 73 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 73 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 73 | const auto& vec_from = col_from->get_data(); | 817 | 73 | const auto* vec_from_data = vec_from.data(); | 818 | 73 | auto& vec_to = col_to->get_data(); | 819 | 73 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 73 | CastParameters params; | 822 | 73 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 73 | size_t size = vec_from.size(); | 824 | | | 825 | 73 | typename ToFieldType::NativeType scale_multiplier = | 826 | 73 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 73 | typename ToFieldType::NativeType max_result = | 828 | 73 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 73 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 427 | for (size_t i = 0; i < size; i++) { | 831 | 354 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 354 | typename ToDataType::FieldType>( | 833 | 354 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 354 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 18 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 0 | return params.status; | 839 | 0 | } | 840 | 18 | } | 841 | 354 | } | 842 | | | 843 | 73 | block.get_by_position(result).column = | 844 | 73 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 73 | return Status::OK(); | 846 | 73 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 18 | using FromFieldType = typename FromDataType::FieldType; | 785 | 18 | using ToFieldType = typename ToDataType::FieldType; | 786 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 18 | const auto* col_from = | 788 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 18 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 18 | UInt32 from_scale = 0; | 796 | | | 797 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 18 | ToDataType::check_type_precision(to_precision); | 801 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 18 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 18 | bool narrow_integral = | 807 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 18 | const auto& vec_from = col_from->get_data(); | 817 | 18 | const auto* vec_from_data = vec_from.data(); | 818 | 18 | auto& vec_to = col_to->get_data(); | 819 | 18 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 18 | CastParameters params; | 822 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 18 | size_t size = vec_from.size(); | 824 | | | 825 | 18 | typename ToFieldType::NativeType scale_multiplier = | 826 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 18 | typename ToFieldType::NativeType max_result = | 828 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 18 | for (size_t i = 0; i < size; i++) { | 831 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 18 | typename ToDataType::FieldType>( | 833 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 18 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 0 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 18 | return params.status; | 839 | 18 | } | 840 | 18 | } | 841 | 18 | } | 842 | | | 843 | 0 | block.get_by_position(result).column = | 844 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 0 | return Status::OK(); | 846 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 69 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 69 | using FromFieldType = typename FromDataType::FieldType; | 785 | 69 | using ToFieldType = typename ToDataType::FieldType; | 786 | 69 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 69 | const auto* col_from = | 788 | 69 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 69 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 69 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 69 | UInt32 from_scale = 0; | 796 | | | 797 | 69 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 69 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 69 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 69 | ToDataType::check_type_precision(to_precision); | 801 | 69 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 69 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 69 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 69 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 69 | bool narrow_integral = | 807 | 69 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 69 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 69 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 69 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 69 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 69 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 69 | const auto& vec_from = col_from->get_data(); | 817 | 69 | const auto* vec_from_data = vec_from.data(); | 818 | 69 | auto& vec_to = col_to->get_data(); | 819 | 69 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 69 | CastParameters params; | 822 | 69 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 69 | size_t size = vec_from.size(); | 824 | | | 825 | 69 | typename ToFieldType::NativeType scale_multiplier = | 826 | 69 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 69 | typename ToFieldType::NativeType max_result = | 828 | 69 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 69 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 475 | for (size_t i = 0; i < size; i++) { | 831 | 406 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 406 | typename ToDataType::FieldType>( | 833 | 406 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 406 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 18 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 0 | return params.status; | 839 | 0 | } | 840 | 18 | } | 841 | 406 | } | 842 | | | 843 | 69 | block.get_by_position(result).column = | 844 | 69 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 69 | return Status::OK(); | 846 | 69 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 18 | using FromFieldType = typename FromDataType::FieldType; | 785 | 18 | using ToFieldType = typename ToDataType::FieldType; | 786 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 18 | const auto* col_from = | 788 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 18 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 18 | UInt32 from_scale = 0; | 796 | | | 797 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 18 | ToDataType::check_type_precision(to_precision); | 801 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 18 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 18 | bool narrow_integral = | 807 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 18 | const auto& vec_from = col_from->get_data(); | 817 | 18 | const auto* vec_from_data = vec_from.data(); | 818 | 18 | auto& vec_to = col_to->get_data(); | 819 | 18 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 18 | CastParameters params; | 822 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 18 | size_t size = vec_from.size(); | 824 | | | 825 | 18 | typename ToFieldType::NativeType scale_multiplier = | 826 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 18 | typename ToFieldType::NativeType max_result = | 828 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 18 | for (size_t i = 0; i < size; i++) { | 831 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 18 | typename ToDataType::FieldType>( | 833 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 18 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 0 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 18 | return params.status; | 839 | 18 | } | 840 | 18 | } | 841 | 18 | } | 842 | | | 843 | 0 | block.get_by_position(result).column = | 844 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 0 | return Status::OK(); | 846 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 783 | 81 | const NullMap::value_type* null_map = nullptr) const override { | 784 | 81 | using FromFieldType = typename FromDataType::FieldType; | 785 | 81 | using ToFieldType = typename ToDataType::FieldType; | 786 | 81 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 787 | 81 | const auto* col_from = | 788 | 81 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 789 | 81 | if (!col_from) { | 790 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 791 | 0 | named_from.column->get_name()); | 792 | 0 | } | 793 | | | 794 | 81 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 795 | 81 | UInt32 from_scale = 0; | 796 | | | 797 | 81 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 798 | 81 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 799 | 81 | UInt32 to_precision = to_decimal_type.get_precision(); | 800 | 81 | ToDataType::check_type_precision(to_precision); | 801 | 81 | UInt32 to_scale = to_decimal_type.get_scale(); | 802 | 81 | ToDataType::check_type_scale(to_scale); | 803 | | | 804 | 81 | auto from_max_int_digit_count = from_precision - from_scale; | 805 | 81 | auto to_max_int_digit_count = to_precision - to_scale; | 806 | 81 | bool narrow_integral = | 807 | 81 | (to_max_int_digit_count < from_max_int_digit_count) || | 808 | 81 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 809 | | // only in non-strict mode and may overflow, we set nullable | 810 | 81 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 811 | | | 812 | 81 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 813 | 81 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 814 | | | 815 | 81 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 816 | 81 | const auto& vec_from = col_from->get_data(); | 817 | 81 | const auto* vec_from_data = vec_from.data(); | 818 | 81 | auto& vec_to = col_to->get_data(); | 819 | 81 | auto* vec_to_data = vec_to.data(); | 820 | | | 821 | 81 | CastParameters params; | 822 | 81 | params.is_strict = (CastMode == CastModeType::StrictMode); | 823 | 81 | size_t size = vec_from.size(); | 824 | | | 825 | 81 | typename ToFieldType::NativeType scale_multiplier = | 826 | 81 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 827 | 81 | typename ToFieldType::NativeType max_result = | 828 | 81 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 829 | 81 | typename ToFieldType::NativeType min_result = -max_result; | 830 | 499 | for (size_t i = 0; i < size; i++) { | 831 | 418 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 832 | 418 | typename ToDataType::FieldType>( | 833 | 418 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 834 | 418 | min_result, max_result, params)) { | 835 | 18 | if (set_nullable) { | 836 | 18 | null_map_data[i] = 1; | 837 | 18 | } else { | 838 | 0 | return params.status; | 839 | 0 | } | 840 | 18 | } | 841 | 418 | } | 842 | | | 843 | 81 | block.get_by_position(result).column = | 844 | 81 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 845 | 81 | return Status::OK(); | 846 | 81 | } |
|
847 | | }; |
848 | | |
849 | | // cast decimalv3 types to decimalv2 types |
850 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
851 | | requires(IsDataTypeDecimalV3<ToDataType> && IsDataTypeDecimalV2<ToDataType>) |
852 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
853 | | public: |
854 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
855 | | uint32_t result, size_t input_rows_count, |
856 | | const NullMap::value_type* null_map = nullptr) const override { |
857 | | return Status::RuntimeError( |
858 | | "not support {} ", |
859 | | cast_mode_type_to_string(CastMode, block.get_by_position(arguments[0]).type, |
860 | | block.get_by_position(result).type)); |
861 | | } |
862 | | }; |
863 | | |
864 | | // cast decimalv2 types to decimalv3 types |
865 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
866 | | requires(IsDataTypeDecimalV2<FromDataType> && IsDataTypeDecimalV3<ToDataType>) |
867 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
868 | | public: |
869 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
870 | | uint32_t result, size_t input_rows_count, |
871 | 608 | const NullMap::value_type* null_map = nullptr) const override { |
872 | 608 | using FromFieldType = typename FromDataType::FieldType; |
873 | 608 | using ToFieldType = typename ToDataType::FieldType; |
874 | 608 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
875 | 608 | const auto* col_from = |
876 | 608 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
877 | 608 | if (!col_from) { |
878 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
879 | 0 | named_from.column->get_name()); |
880 | 0 | } |
881 | | |
882 | 608 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); |
883 | 608 | UInt32 from_precision = from_decimal_type.get_precision(); |
884 | 608 | UInt32 from_scale = from_decimal_type.get_scale(); |
885 | 608 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); |
886 | 608 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); |
887 | | |
888 | 608 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
889 | 608 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
890 | 608 | UInt32 to_precision = to_decimal_type.get_precision(); |
891 | 608 | ToDataType::check_type_precision(to_precision); |
892 | 608 | UInt32 to_scale = to_decimal_type.get_scale(); |
893 | 608 | ToDataType::check_type_scale(to_scale); |
894 | | |
895 | 608 | auto from_max_int_digit_count = from_original_precision - from_original_scale; |
896 | 608 | auto to_max_int_digit_count = to_precision - to_scale; |
897 | 608 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || |
898 | 608 | (to_max_int_digit_count == from_max_int_digit_count && |
899 | 216 | to_scale < from_original_scale); |
900 | | // only in non-strict mode and may overflow, we set nullable |
901 | 608 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
902 | | |
903 | 608 | size_t size = col_from->size(); |
904 | 608 | ColumnUInt8::MutablePtr col_null_map_to; |
905 | 608 | NullMap::value_type* null_map_data = nullptr; |
906 | 608 | if (narrow_integral) { |
907 | 410 | col_null_map_to = ColumnUInt8::create(size, 0); |
908 | 410 | null_map_data = col_null_map_to->get_data().data(); |
909 | 410 | } |
910 | 608 | CastParameters params; |
911 | 608 | params.is_strict = (CastMode == CastModeType::StrictMode); |
912 | 608 | auto col_to = ToDataType::ColumnType::create(size, to_scale); |
913 | 608 | const auto& vec_from = col_from->get_data(); |
914 | 608 | const auto* vec_from_data = vec_from.data(); |
915 | 608 | auto& vec_to = col_to->get_data(); |
916 | 608 | auto* vec_to_data = vec_to.data(); |
917 | | |
918 | 608 | using MaxFieldType = |
919 | 608 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && |
920 | 608 | (std::is_same_v<ToFieldType, Decimal128V3> || |
921 | 608 | std::is_same_v<FromFieldType, Decimal128V3>), |
922 | 608 | Decimal128V3, |
923 | 608 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), |
924 | 608 | FromFieldType, ToFieldType>>; |
925 | 608 | using MaxNativeType = typename MaxFieldType::NativeType; |
926 | | |
927 | 608 | constexpr UInt32 to_max_digits = |
928 | 608 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
929 | 608 | bool multiply_may_overflow = false; |
930 | 608 | if (to_scale > from_scale) { |
931 | 186 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
932 | 186 | } |
933 | | |
934 | 608 | typename ToFieldType::NativeType max_result = |
935 | 608 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
936 | 608 | typename ToFieldType::NativeType min_result = -max_result; |
937 | | |
938 | 608 | MaxNativeType multiplier {}; |
939 | 608 | if (from_scale < to_scale) { |
940 | 186 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
941 | 186 | from_scale); |
942 | 422 | } else if (from_scale > to_scale) { |
943 | 388 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
944 | 388 | to_scale); |
945 | 388 | } |
946 | 608 | RETURN_IF_ERROR(std::visit( |
947 | 608 | [&](auto multiply_may_overflow, auto narrow_integral) { |
948 | 608 | for (size_t i = 0; i < size; i++) { |
949 | 608 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, |
950 | 608 | multiply_may_overflow, narrow_integral>( |
951 | 608 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], |
952 | 608 | to_precision, to_scale, min_result, max_result, multiplier, |
953 | 608 | params)) { |
954 | 608 | if (set_nullable) { |
955 | 608 | null_map_data[i] = 1; |
956 | 608 | } else { |
957 | 608 | return params.status; |
958 | 608 | } |
959 | 608 | } |
960 | 608 | } |
961 | 608 | return Status::OK(); |
962 | 608 | }, |
963 | 608 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
964 | 387 | if (narrow_integral) { |
965 | 189 | block.get_by_position(result).column = |
966 | 189 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
967 | 198 | } else { |
968 | 198 | block.get_by_position(result).column = std::move(col_to); |
969 | 198 | } |
970 | 387 | return Status::OK(); |
971 | 608 | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 871 | 87 | const NullMap::value_type* null_map = nullptr) const override { | 872 | 87 | using FromFieldType = typename FromDataType::FieldType; | 873 | 87 | using ToFieldType = typename ToDataType::FieldType; | 874 | 87 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 875 | 87 | const auto* col_from = | 876 | 87 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 877 | 87 | if (!col_from) { | 878 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 879 | 0 | named_from.column->get_name()); | 880 | 0 | } | 881 | | | 882 | 87 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 883 | 87 | UInt32 from_precision = from_decimal_type.get_precision(); | 884 | 87 | UInt32 from_scale = from_decimal_type.get_scale(); | 885 | 87 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 886 | 87 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 887 | | | 888 | 87 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 889 | 87 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 890 | 87 | UInt32 to_precision = to_decimal_type.get_precision(); | 891 | 87 | ToDataType::check_type_precision(to_precision); | 892 | 87 | UInt32 to_scale = to_decimal_type.get_scale(); | 893 | 87 | ToDataType::check_type_scale(to_scale); | 894 | | | 895 | 87 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 896 | 87 | auto to_max_int_digit_count = to_precision - to_scale; | 897 | 87 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 898 | 87 | (to_max_int_digit_count == from_max_int_digit_count && | 899 | 0 | to_scale < from_original_scale); | 900 | | // only in non-strict mode and may overflow, we set nullable | 901 | 87 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 902 | | | 903 | 87 | size_t size = col_from->size(); | 904 | 87 | ColumnUInt8::MutablePtr col_null_map_to; | 905 | 87 | NullMap::value_type* null_map_data = nullptr; | 906 | 87 | if (narrow_integral) { | 907 | 87 | col_null_map_to = ColumnUInt8::create(size, 0); | 908 | 87 | null_map_data = col_null_map_to->get_data().data(); | 909 | 87 | } | 910 | 87 | CastParameters params; | 911 | 87 | params.is_strict = (CastMode == CastModeType::StrictMode); | 912 | 87 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 913 | 87 | const auto& vec_from = col_from->get_data(); | 914 | 87 | const auto* vec_from_data = vec_from.data(); | 915 | 87 | auto& vec_to = col_to->get_data(); | 916 | 87 | auto* vec_to_data = vec_to.data(); | 917 | | | 918 | 87 | using MaxFieldType = | 919 | 87 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 920 | 87 | (std::is_same_v<ToFieldType, Decimal128V3> || | 921 | 87 | std::is_same_v<FromFieldType, Decimal128V3>), | 922 | 87 | Decimal128V3, | 923 | 87 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 924 | 87 | FromFieldType, ToFieldType>>; | 925 | 87 | using MaxNativeType = typename MaxFieldType::NativeType; | 926 | | | 927 | 87 | constexpr UInt32 to_max_digits = | 928 | 87 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 929 | 87 | bool multiply_may_overflow = false; | 930 | 87 | if (to_scale > from_scale) { | 931 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 932 | 0 | } | 933 | | | 934 | 87 | typename ToFieldType::NativeType max_result = | 935 | 87 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 936 | 87 | typename ToFieldType::NativeType min_result = -max_result; | 937 | | | 938 | 87 | MaxNativeType multiplier {}; | 939 | 87 | if (from_scale < to_scale) { | 940 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 941 | 0 | from_scale); | 942 | 87 | } else if (from_scale > to_scale) { | 943 | 78 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 944 | 78 | to_scale); | 945 | 78 | } | 946 | 87 | RETURN_IF_ERROR(std::visit( | 947 | 87 | [&](auto multiply_may_overflow, auto narrow_integral) { | 948 | 87 | for (size_t i = 0; i < size; i++) { | 949 | 87 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 950 | 87 | multiply_may_overflow, narrow_integral>( | 951 | 87 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 952 | 87 | to_precision, to_scale, min_result, max_result, multiplier, | 953 | 87 | params)) { | 954 | 87 | if (set_nullable) { | 955 | 87 | null_map_data[i] = 1; | 956 | 87 | } else { | 957 | 87 | return params.status; | 958 | 87 | } | 959 | 87 | } | 960 | 87 | } | 961 | 87 | return Status::OK(); | 962 | 87 | }, | 963 | 87 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 964 | 0 | if (narrow_integral) { | 965 | 0 | block.get_by_position(result).column = | 966 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 967 | 0 | } else { | 968 | 0 | block.get_by_position(result).column = std::move(col_to); | 969 | 0 | } | 970 | 0 | return Status::OK(); | 971 | 87 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 871 | 74 | const NullMap::value_type* null_map = nullptr) const override { | 872 | 74 | using FromFieldType = typename FromDataType::FieldType; | 873 | 74 | using ToFieldType = typename ToDataType::FieldType; | 874 | 74 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 875 | 74 | const auto* col_from = | 876 | 74 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 877 | 74 | if (!col_from) { | 878 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 879 | 0 | named_from.column->get_name()); | 880 | 0 | } | 881 | | | 882 | 74 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 883 | 74 | UInt32 from_precision = from_decimal_type.get_precision(); | 884 | 74 | UInt32 from_scale = from_decimal_type.get_scale(); | 885 | 74 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 886 | 74 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 887 | | | 888 | 74 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 889 | 74 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 890 | 74 | UInt32 to_precision = to_decimal_type.get_precision(); | 891 | 74 | ToDataType::check_type_precision(to_precision); | 892 | 74 | UInt32 to_scale = to_decimal_type.get_scale(); | 893 | 74 | ToDataType::check_type_scale(to_scale); | 894 | | | 895 | 74 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 896 | 74 | auto to_max_int_digit_count = to_precision - to_scale; | 897 | 74 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 898 | 74 | (to_max_int_digit_count == from_max_int_digit_count && | 899 | 18 | to_scale < from_original_scale); | 900 | | // only in non-strict mode and may overflow, we set nullable | 901 | 74 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 902 | | | 903 | 74 | size_t size = col_from->size(); | 904 | 74 | ColumnUInt8::MutablePtr col_null_map_to; | 905 | 74 | NullMap::value_type* null_map_data = nullptr; | 906 | 74 | if (narrow_integral) { | 907 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 908 | 56 | null_map_data = col_null_map_to->get_data().data(); | 909 | 56 | } | 910 | 74 | CastParameters params; | 911 | 74 | params.is_strict = (CastMode == CastModeType::StrictMode); | 912 | 74 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 913 | 74 | const auto& vec_from = col_from->get_data(); | 914 | 74 | const auto* vec_from_data = vec_from.data(); | 915 | 74 | auto& vec_to = col_to->get_data(); | 916 | 74 | auto* vec_to_data = vec_to.data(); | 917 | | | 918 | 74 | using MaxFieldType = | 919 | 74 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 920 | 74 | (std::is_same_v<ToFieldType, Decimal128V3> || | 921 | 74 | std::is_same_v<FromFieldType, Decimal128V3>), | 922 | 74 | Decimal128V3, | 923 | 74 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 924 | 74 | FromFieldType, ToFieldType>>; | 925 | 74 | using MaxNativeType = typename MaxFieldType::NativeType; | 926 | | | 927 | 74 | constexpr UInt32 to_max_digits = | 928 | 74 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 929 | 74 | bool multiply_may_overflow = false; | 930 | 74 | if (to_scale > from_scale) { | 931 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 932 | 0 | } | 933 | | | 934 | 74 | typename ToFieldType::NativeType max_result = | 935 | 74 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 936 | 74 | typename ToFieldType::NativeType min_result = -max_result; | 937 | | | 938 | 74 | MaxNativeType multiplier {}; | 939 | 74 | if (from_scale < to_scale) { | 940 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 941 | 0 | from_scale); | 942 | 74 | } else if (from_scale > to_scale) { | 943 | 67 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 944 | 67 | to_scale); | 945 | 67 | } | 946 | 74 | RETURN_IF_ERROR(std::visit( | 947 | 74 | [&](auto multiply_may_overflow, auto narrow_integral) { | 948 | 74 | for (size_t i = 0; i < size; i++) { | 949 | 74 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 950 | 74 | multiply_may_overflow, narrow_integral>( | 951 | 74 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 952 | 74 | to_precision, to_scale, min_result, max_result, multiplier, | 953 | 74 | params)) { | 954 | 74 | if (set_nullable) { | 955 | 74 | null_map_data[i] = 1; | 956 | 74 | } else { | 957 | 74 | return params.status; | 958 | 74 | } | 959 | 74 | } | 960 | 74 | } | 961 | 74 | return Status::OK(); | 962 | 74 | }, | 963 | 74 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 964 | 74 | if (narrow_integral) { | 965 | 56 | block.get_by_position(result).column = | 966 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 967 | 56 | } else { | 968 | 18 | block.get_by_position(result).column = std::move(col_to); | 969 | 18 | } | 970 | 74 | return Status::OK(); | 971 | 74 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 871 | 72 | const NullMap::value_type* null_map = nullptr) const override { | 872 | 72 | using FromFieldType = typename FromDataType::FieldType; | 873 | 72 | using ToFieldType = typename ToDataType::FieldType; | 874 | 72 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 875 | 72 | const auto* col_from = | 876 | 72 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 877 | 72 | if (!col_from) { | 878 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 879 | 0 | named_from.column->get_name()); | 880 | 0 | } | 881 | | | 882 | 72 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 883 | 72 | UInt32 from_precision = from_decimal_type.get_precision(); | 884 | 72 | UInt32 from_scale = from_decimal_type.get_scale(); | 885 | 72 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 886 | 72 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 887 | | | 888 | 72 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 889 | 72 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 890 | 72 | UInt32 to_precision = to_decimal_type.get_precision(); | 891 | 72 | ToDataType::check_type_precision(to_precision); | 892 | 72 | UInt32 to_scale = to_decimal_type.get_scale(); | 893 | 72 | ToDataType::check_type_scale(to_scale); | 894 | | | 895 | 72 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 896 | 72 | auto to_max_int_digit_count = to_precision - to_scale; | 897 | 72 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 898 | 72 | (to_max_int_digit_count == from_max_int_digit_count && | 899 | 2 | to_scale < from_original_scale); | 900 | | // only in non-strict mode and may overflow, we set nullable | 901 | 72 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 902 | | | 903 | 72 | size_t size = col_from->size(); | 904 | 72 | ColumnUInt8::MutablePtr col_null_map_to; | 905 | 72 | NullMap::value_type* null_map_data = nullptr; | 906 | 72 | if (narrow_integral) { | 907 | 72 | col_null_map_to = ColumnUInt8::create(size, 0); | 908 | 72 | null_map_data = col_null_map_to->get_data().data(); | 909 | 72 | } | 910 | 72 | CastParameters params; | 911 | 72 | params.is_strict = (CastMode == CastModeType::StrictMode); | 912 | 72 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 913 | 72 | const auto& vec_from = col_from->get_data(); | 914 | 72 | const auto* vec_from_data = vec_from.data(); | 915 | 72 | auto& vec_to = col_to->get_data(); | 916 | 72 | auto* vec_to_data = vec_to.data(); | 917 | | | 918 | 72 | using MaxFieldType = | 919 | 72 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 920 | 72 | (std::is_same_v<ToFieldType, Decimal128V3> || | 921 | 72 | std::is_same_v<FromFieldType, Decimal128V3>), | 922 | 72 | Decimal128V3, | 923 | 72 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 924 | 72 | FromFieldType, ToFieldType>>; | 925 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 926 | | | 927 | 72 | constexpr UInt32 to_max_digits = | 928 | 72 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 929 | 72 | bool multiply_may_overflow = false; | 930 | 72 | if (to_scale > from_scale) { | 931 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 932 | 24 | } | 933 | | | 934 | 72 | typename ToFieldType::NativeType max_result = | 935 | 72 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 936 | 72 | typename ToFieldType::NativeType min_result = -max_result; | 937 | | | 938 | 72 | MaxNativeType multiplier {}; | 939 | 72 | if (from_scale < to_scale) { | 940 | 24 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 941 | 24 | from_scale); | 942 | 48 | } else if (from_scale > to_scale) { | 943 | 42 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 944 | 42 | to_scale); | 945 | 42 | } | 946 | 72 | RETURN_IF_ERROR(std::visit( | 947 | 72 | [&](auto multiply_may_overflow, auto narrow_integral) { | 948 | 72 | for (size_t i = 0; i < size; i++) { | 949 | 72 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 950 | 72 | multiply_may_overflow, narrow_integral>( | 951 | 72 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 952 | 72 | to_precision, to_scale, min_result, max_result, multiplier, | 953 | 72 | params)) { | 954 | 72 | if (set_nullable) { | 955 | 72 | null_map_data[i] = 1; | 956 | 72 | } else { | 957 | 72 | return params.status; | 958 | 72 | } | 959 | 72 | } | 960 | 72 | } | 961 | 72 | return Status::OK(); | 962 | 72 | }, | 963 | 72 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 964 | 0 | if (narrow_integral) { | 965 | 0 | block.get_by_position(result).column = | 966 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 967 | 0 | } else { | 968 | 0 | block.get_by_position(result).column = std::move(col_to); | 969 | 0 | } | 970 | 0 | return Status::OK(); | 971 | 72 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 871 | 108 | const NullMap::value_type* null_map = nullptr) const override { | 872 | 108 | using FromFieldType = typename FromDataType::FieldType; | 873 | 108 | using ToFieldType = typename ToDataType::FieldType; | 874 | 108 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 875 | 108 | const auto* col_from = | 876 | 108 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 877 | 108 | if (!col_from) { | 878 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 879 | 0 | named_from.column->get_name()); | 880 | 0 | } | 881 | | | 882 | 108 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 883 | 108 | UInt32 from_precision = from_decimal_type.get_precision(); | 884 | 108 | UInt32 from_scale = from_decimal_type.get_scale(); | 885 | 108 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 886 | 108 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 887 | | | 888 | 108 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 889 | 108 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 890 | 108 | UInt32 to_precision = to_decimal_type.get_precision(); | 891 | 108 | ToDataType::check_type_precision(to_precision); | 892 | 108 | UInt32 to_scale = to_decimal_type.get_scale(); | 893 | 108 | ToDataType::check_type_scale(to_scale); | 894 | | | 895 | 108 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 896 | 108 | auto to_max_int_digit_count = to_precision - to_scale; | 897 | 108 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 898 | 108 | (to_max_int_digit_count == from_max_int_digit_count && | 899 | 45 | to_scale < from_original_scale); | 900 | | // only in non-strict mode and may overflow, we set nullable | 901 | 108 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 902 | | | 903 | 108 | size_t size = col_from->size(); | 904 | 108 | ColumnUInt8::MutablePtr col_null_map_to; | 905 | 108 | NullMap::value_type* null_map_data = nullptr; | 906 | 108 | if (narrow_integral) { | 907 | 70 | col_null_map_to = ColumnUInt8::create(size, 0); | 908 | 70 | null_map_data = col_null_map_to->get_data().data(); | 909 | 70 | } | 910 | 108 | CastParameters params; | 911 | 108 | params.is_strict = (CastMode == CastModeType::StrictMode); | 912 | 108 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 913 | 108 | const auto& vec_from = col_from->get_data(); | 914 | 108 | const auto* vec_from_data = vec_from.data(); | 915 | 108 | auto& vec_to = col_to->get_data(); | 916 | 108 | auto* vec_to_data = vec_to.data(); | 917 | | | 918 | 108 | using MaxFieldType = | 919 | 108 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 920 | 108 | (std::is_same_v<ToFieldType, Decimal128V3> || | 921 | 108 | std::is_same_v<FromFieldType, Decimal128V3>), | 922 | 108 | Decimal128V3, | 923 | 108 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 924 | 108 | FromFieldType, ToFieldType>>; | 925 | 108 | using MaxNativeType = typename MaxFieldType::NativeType; | 926 | | | 927 | 108 | constexpr UInt32 to_max_digits = | 928 | 108 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 929 | 108 | bool multiply_may_overflow = false; | 930 | 108 | if (to_scale > from_scale) { | 931 | 26 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 932 | 26 | } | 933 | | | 934 | 108 | typename ToFieldType::NativeType max_result = | 935 | 108 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 936 | 108 | typename ToFieldType::NativeType min_result = -max_result; | 937 | | | 938 | 108 | MaxNativeType multiplier {}; | 939 | 108 | if (from_scale < to_scale) { | 940 | 26 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 941 | 26 | from_scale); | 942 | 82 | } else if (from_scale > to_scale) { | 943 | 70 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 944 | 70 | to_scale); | 945 | 70 | } | 946 | 108 | RETURN_IF_ERROR(std::visit( | 947 | 108 | [&](auto multiply_may_overflow, auto narrow_integral) { | 948 | 108 | for (size_t i = 0; i < size; i++) { | 949 | 108 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 950 | 108 | multiply_may_overflow, narrow_integral>( | 951 | 108 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 952 | 108 | to_precision, to_scale, min_result, max_result, multiplier, | 953 | 108 | params)) { | 954 | 108 | if (set_nullable) { | 955 | 108 | null_map_data[i] = 1; | 956 | 108 | } else { | 957 | 108 | return params.status; | 958 | 108 | } | 959 | 108 | } | 960 | 108 | } | 961 | 108 | return Status::OK(); | 962 | 108 | }, | 963 | 108 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 964 | 108 | if (narrow_integral) { | 965 | 70 | block.get_by_position(result).column = | 966 | 70 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 967 | 70 | } else { | 968 | 38 | block.get_by_position(result).column = std::move(col_to); | 969 | 38 | } | 970 | 108 | return Status::OK(); | 971 | 108 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 871 | 32 | const NullMap::value_type* null_map = nullptr) const override { | 872 | 32 | using FromFieldType = typename FromDataType::FieldType; | 873 | 32 | using ToFieldType = typename ToDataType::FieldType; | 874 | 32 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 875 | 32 | const auto* col_from = | 876 | 32 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 877 | 32 | if (!col_from) { | 878 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 879 | 0 | named_from.column->get_name()); | 880 | 0 | } | 881 | | | 882 | 32 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 883 | 32 | UInt32 from_precision = from_decimal_type.get_precision(); | 884 | 32 | UInt32 from_scale = from_decimal_type.get_scale(); | 885 | 32 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 886 | 32 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 887 | | | 888 | 32 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 889 | 32 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 890 | 32 | UInt32 to_precision = to_decimal_type.get_precision(); | 891 | 32 | ToDataType::check_type_precision(to_precision); | 892 | 32 | UInt32 to_scale = to_decimal_type.get_scale(); | 893 | 32 | ToDataType::check_type_scale(to_scale); | 894 | | | 895 | 32 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 896 | 32 | auto to_max_int_digit_count = to_precision - to_scale; | 897 | 32 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 898 | 32 | (to_max_int_digit_count == from_max_int_digit_count && | 899 | 2 | to_scale < from_original_scale); | 900 | | // only in non-strict mode and may overflow, we set nullable | 901 | 32 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 902 | | | 903 | 32 | size_t size = col_from->size(); | 904 | 32 | ColumnUInt8::MutablePtr col_null_map_to; | 905 | 32 | NullMap::value_type* null_map_data = nullptr; | 906 | 32 | if (narrow_integral) { | 907 | 32 | col_null_map_to = ColumnUInt8::create(size, 0); | 908 | 32 | null_map_data = col_null_map_to->get_data().data(); | 909 | 32 | } | 910 | 32 | CastParameters params; | 911 | 32 | params.is_strict = (CastMode == CastModeType::StrictMode); | 912 | 32 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 913 | 32 | const auto& vec_from = col_from->get_data(); | 914 | 32 | const auto* vec_from_data = vec_from.data(); | 915 | 32 | auto& vec_to = col_to->get_data(); | 916 | 32 | auto* vec_to_data = vec_to.data(); | 917 | | | 918 | 32 | using MaxFieldType = | 919 | 32 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 920 | 32 | (std::is_same_v<ToFieldType, Decimal128V3> || | 921 | 32 | std::is_same_v<FromFieldType, Decimal128V3>), | 922 | 32 | Decimal128V3, | 923 | 32 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 924 | 32 | FromFieldType, ToFieldType>>; | 925 | 32 | using MaxNativeType = typename MaxFieldType::NativeType; | 926 | | | 927 | 32 | constexpr UInt32 to_max_digits = | 928 | 32 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 929 | 32 | bool multiply_may_overflow = false; | 930 | 32 | if (to_scale > from_scale) { | 931 | 30 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 932 | 30 | } | 933 | | | 934 | 32 | typename ToFieldType::NativeType max_result = | 935 | 32 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 936 | 32 | typename ToFieldType::NativeType min_result = -max_result; | 937 | | | 938 | 32 | MaxNativeType multiplier {}; | 939 | 32 | if (from_scale < to_scale) { | 940 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 941 | 30 | from_scale); | 942 | 30 | } else if (from_scale > to_scale) { | 943 | 2 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 944 | 2 | to_scale); | 945 | 2 | } | 946 | 32 | RETURN_IF_ERROR(std::visit( | 947 | 32 | [&](auto multiply_may_overflow, auto narrow_integral) { | 948 | 32 | for (size_t i = 0; i < size; i++) { | 949 | 32 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 950 | 32 | multiply_may_overflow, narrow_integral>( | 951 | 32 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 952 | 32 | to_precision, to_scale, min_result, max_result, multiplier, | 953 | 32 | params)) { | 954 | 32 | if (set_nullable) { | 955 | 32 | null_map_data[i] = 1; | 956 | 32 | } else { | 957 | 32 | return params.status; | 958 | 32 | } | 959 | 32 | } | 960 | 32 | } | 961 | 32 | return Status::OK(); | 962 | 32 | }, | 963 | 32 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 964 | 0 | if (narrow_integral) { | 965 | 0 | block.get_by_position(result).column = | 966 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 967 | 0 | } else { | 968 | 0 | block.get_by_position(result).column = std::move(col_to); | 969 | 0 | } | 970 | 0 | return Status::OK(); | 971 | 32 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 871 | 103 | const NullMap::value_type* null_map = nullptr) const override { | 872 | 103 | using FromFieldType = typename FromDataType::FieldType; | 873 | 103 | using ToFieldType = typename ToDataType::FieldType; | 874 | 103 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 875 | 103 | const auto* col_from = | 876 | 103 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 877 | 103 | if (!col_from) { | 878 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 879 | 0 | named_from.column->get_name()); | 880 | 0 | } | 881 | | | 882 | 103 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 883 | 103 | UInt32 from_precision = from_decimal_type.get_precision(); | 884 | 103 | UInt32 from_scale = from_decimal_type.get_scale(); | 885 | 103 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 886 | 103 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 887 | | | 888 | 103 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 889 | 103 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 890 | 103 | UInt32 to_precision = to_decimal_type.get_precision(); | 891 | 103 | ToDataType::check_type_precision(to_precision); | 892 | 103 | UInt32 to_scale = to_decimal_type.get_scale(); | 893 | 103 | ToDataType::check_type_scale(to_scale); | 894 | | | 895 | 103 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 896 | 103 | auto to_max_int_digit_count = to_precision - to_scale; | 897 | 103 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 898 | 103 | (to_max_int_digit_count == from_max_int_digit_count && | 899 | 75 | to_scale < from_original_scale); | 900 | | // only in non-strict mode and may overflow, we set nullable | 901 | 103 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 902 | | | 903 | 103 | size_t size = col_from->size(); | 904 | 103 | ColumnUInt8::MutablePtr col_null_map_to; | 905 | 103 | NullMap::value_type* null_map_data = nullptr; | 906 | 103 | if (narrow_integral) { | 907 | 35 | col_null_map_to = ColumnUInt8::create(size, 0); | 908 | 35 | null_map_data = col_null_map_to->get_data().data(); | 909 | 35 | } | 910 | 103 | CastParameters params; | 911 | 103 | params.is_strict = (CastMode == CastModeType::StrictMode); | 912 | 103 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 913 | 103 | const auto& vec_from = col_from->get_data(); | 914 | 103 | const auto* vec_from_data = vec_from.data(); | 915 | 103 | auto& vec_to = col_to->get_data(); | 916 | 103 | auto* vec_to_data = vec_to.data(); | 917 | | | 918 | 103 | using MaxFieldType = | 919 | 103 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 920 | 103 | (std::is_same_v<ToFieldType, Decimal128V3> || | 921 | 103 | std::is_same_v<FromFieldType, Decimal128V3>), | 922 | 103 | Decimal128V3, | 923 | 103 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 924 | 103 | FromFieldType, ToFieldType>>; | 925 | 103 | using MaxNativeType = typename MaxFieldType::NativeType; | 926 | | | 927 | 103 | constexpr UInt32 to_max_digits = | 928 | 103 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 929 | 103 | bool multiply_may_overflow = false; | 930 | 103 | if (to_scale > from_scale) { | 931 | 38 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 932 | 38 | } | 933 | | | 934 | 103 | typename ToFieldType::NativeType max_result = | 935 | 103 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 936 | 103 | typename ToFieldType::NativeType min_result = -max_result; | 937 | | | 938 | 103 | MaxNativeType multiplier {}; | 939 | 103 | if (from_scale < to_scale) { | 940 | 38 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 941 | 38 | from_scale); | 942 | 65 | } else if (from_scale > to_scale) { | 943 | 65 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 944 | 65 | to_scale); | 945 | 65 | } | 946 | 103 | RETURN_IF_ERROR(std::visit( | 947 | 103 | [&](auto multiply_may_overflow, auto narrow_integral) { | 948 | 103 | for (size_t i = 0; i < size; i++) { | 949 | 103 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 950 | 103 | multiply_may_overflow, narrow_integral>( | 951 | 103 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 952 | 103 | to_precision, to_scale, min_result, max_result, multiplier, | 953 | 103 | params)) { | 954 | 103 | if (set_nullable) { | 955 | 103 | null_map_data[i] = 1; | 956 | 103 | } else { | 957 | 103 | return params.status; | 958 | 103 | } | 959 | 103 | } | 960 | 103 | } | 961 | 103 | return Status::OK(); | 962 | 103 | }, | 963 | 103 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 964 | 103 | if (narrow_integral) { | 965 | 35 | block.get_by_position(result).column = | 966 | 35 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 967 | 68 | } else { | 968 | 68 | block.get_by_position(result).column = std::move(col_to); | 969 | 68 | } | 970 | 103 | return Status::OK(); | 971 | 103 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 871 | 30 | const NullMap::value_type* null_map = nullptr) const override { | 872 | 30 | using FromFieldType = typename FromDataType::FieldType; | 873 | 30 | using ToFieldType = typename ToDataType::FieldType; | 874 | 30 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 875 | 30 | const auto* col_from = | 876 | 30 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 877 | 30 | if (!col_from) { | 878 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 879 | 0 | named_from.column->get_name()); | 880 | 0 | } | 881 | | | 882 | 30 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 883 | 30 | UInt32 from_precision = from_decimal_type.get_precision(); | 884 | 30 | UInt32 from_scale = from_decimal_type.get_scale(); | 885 | 30 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 886 | 30 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 887 | | | 888 | 30 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 889 | 30 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 890 | 30 | UInt32 to_precision = to_decimal_type.get_precision(); | 891 | 30 | ToDataType::check_type_precision(to_precision); | 892 | 30 | UInt32 to_scale = to_decimal_type.get_scale(); | 893 | 30 | ToDataType::check_type_scale(to_scale); | 894 | | | 895 | 30 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 896 | 30 | auto to_max_int_digit_count = to_precision - to_scale; | 897 | 30 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 898 | 30 | (to_max_int_digit_count == from_max_int_digit_count && | 899 | 0 | to_scale < from_original_scale); | 900 | | // only in non-strict mode and may overflow, we set nullable | 901 | 30 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 902 | | | 903 | 30 | size_t size = col_from->size(); | 904 | 30 | ColumnUInt8::MutablePtr col_null_map_to; | 905 | 30 | NullMap::value_type* null_map_data = nullptr; | 906 | 30 | if (narrow_integral) { | 907 | 30 | col_null_map_to = ColumnUInt8::create(size, 0); | 908 | 30 | null_map_data = col_null_map_to->get_data().data(); | 909 | 30 | } | 910 | 30 | CastParameters params; | 911 | 30 | params.is_strict = (CastMode == CastModeType::StrictMode); | 912 | 30 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 913 | 30 | const auto& vec_from = col_from->get_data(); | 914 | 30 | const auto* vec_from_data = vec_from.data(); | 915 | 30 | auto& vec_to = col_to->get_data(); | 916 | 30 | auto* vec_to_data = vec_to.data(); | 917 | | | 918 | 30 | using MaxFieldType = | 919 | 30 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 920 | 30 | (std::is_same_v<ToFieldType, Decimal128V3> || | 921 | 30 | std::is_same_v<FromFieldType, Decimal128V3>), | 922 | 30 | Decimal128V3, | 923 | 30 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 924 | 30 | FromFieldType, ToFieldType>>; | 925 | 30 | using MaxNativeType = typename MaxFieldType::NativeType; | 926 | | | 927 | 30 | constexpr UInt32 to_max_digits = | 928 | 30 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 929 | 30 | bool multiply_may_overflow = false; | 930 | 30 | if (to_scale > from_scale) { | 931 | 30 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 932 | 30 | } | 933 | | | 934 | 30 | typename ToFieldType::NativeType max_result = | 935 | 30 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 936 | 30 | typename ToFieldType::NativeType min_result = -max_result; | 937 | | | 938 | 30 | MaxNativeType multiplier {}; | 939 | 30 | if (from_scale < to_scale) { | 940 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 941 | 30 | from_scale); | 942 | 30 | } else if (from_scale > to_scale) { | 943 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 944 | 0 | to_scale); | 945 | 0 | } | 946 | 30 | RETURN_IF_ERROR(std::visit( | 947 | 30 | [&](auto multiply_may_overflow, auto narrow_integral) { | 948 | 30 | for (size_t i = 0; i < size; i++) { | 949 | 30 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 950 | 30 | multiply_may_overflow, narrow_integral>( | 951 | 30 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 952 | 30 | to_precision, to_scale, min_result, max_result, multiplier, | 953 | 30 | params)) { | 954 | 30 | if (set_nullable) { | 955 | 30 | null_map_data[i] = 1; | 956 | 30 | } else { | 957 | 30 | return params.status; | 958 | 30 | } | 959 | 30 | } | 960 | 30 | } | 961 | 30 | return Status::OK(); | 962 | 30 | }, | 963 | 30 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 964 | 0 | if (narrow_integral) { | 965 | 0 | block.get_by_position(result).column = | 966 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 967 | 0 | } else { | 968 | 0 | block.get_by_position(result).column = std::move(col_to); | 969 | 0 | } | 970 | 0 | return Status::OK(); | 971 | 30 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 871 | 102 | const NullMap::value_type* null_map = nullptr) const override { | 872 | 102 | using FromFieldType = typename FromDataType::FieldType; | 873 | 102 | using ToFieldType = typename ToDataType::FieldType; | 874 | 102 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 875 | 102 | const auto* col_from = | 876 | 102 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 877 | 102 | if (!col_from) { | 878 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 879 | 0 | named_from.column->get_name()); | 880 | 0 | } | 881 | | | 882 | 102 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 883 | 102 | UInt32 from_precision = from_decimal_type.get_precision(); | 884 | 102 | UInt32 from_scale = from_decimal_type.get_scale(); | 885 | 102 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 886 | 102 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 887 | | | 888 | 102 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 889 | 102 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 890 | 102 | UInt32 to_precision = to_decimal_type.get_precision(); | 891 | 102 | ToDataType::check_type_precision(to_precision); | 892 | 102 | UInt32 to_scale = to_decimal_type.get_scale(); | 893 | 102 | ToDataType::check_type_scale(to_scale); | 894 | | | 895 | 102 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 896 | 102 | auto to_max_int_digit_count = to_precision - to_scale; | 897 | 102 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 898 | 102 | (to_max_int_digit_count == from_max_int_digit_count && | 899 | 74 | to_scale < from_original_scale); | 900 | | // only in non-strict mode and may overflow, we set nullable | 901 | 102 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 902 | | | 903 | 102 | size_t size = col_from->size(); | 904 | 102 | ColumnUInt8::MutablePtr col_null_map_to; | 905 | 102 | NullMap::value_type* null_map_data = nullptr; | 906 | 102 | if (narrow_integral) { | 907 | 28 | col_null_map_to = ColumnUInt8::create(size, 0); | 908 | 28 | null_map_data = col_null_map_to->get_data().data(); | 909 | 28 | } | 910 | 102 | CastParameters params; | 911 | 102 | params.is_strict = (CastMode == CastModeType::StrictMode); | 912 | 102 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 913 | 102 | const auto& vec_from = col_from->get_data(); | 914 | 102 | const auto* vec_from_data = vec_from.data(); | 915 | 102 | auto& vec_to = col_to->get_data(); | 916 | 102 | auto* vec_to_data = vec_to.data(); | 917 | | | 918 | 102 | using MaxFieldType = | 919 | 102 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 920 | 102 | (std::is_same_v<ToFieldType, Decimal128V3> || | 921 | 102 | std::is_same_v<FromFieldType, Decimal128V3>), | 922 | 102 | Decimal128V3, | 923 | 102 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 924 | 102 | FromFieldType, ToFieldType>>; | 925 | 102 | using MaxNativeType = typename MaxFieldType::NativeType; | 926 | | | 927 | 102 | constexpr UInt32 to_max_digits = | 928 | 102 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 929 | 102 | bool multiply_may_overflow = false; | 930 | 102 | if (to_scale > from_scale) { | 931 | 38 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 932 | 38 | } | 933 | | | 934 | 102 | typename ToFieldType::NativeType max_result = | 935 | 102 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 936 | 102 | typename ToFieldType::NativeType min_result = -max_result; | 937 | | | 938 | 102 | MaxNativeType multiplier {}; | 939 | 102 | if (from_scale < to_scale) { | 940 | 38 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 941 | 38 | from_scale); | 942 | 64 | } else if (from_scale > to_scale) { | 943 | 64 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 944 | 64 | to_scale); | 945 | 64 | } | 946 | 102 | RETURN_IF_ERROR(std::visit( | 947 | 102 | [&](auto multiply_may_overflow, auto narrow_integral) { | 948 | 102 | for (size_t i = 0; i < size; i++) { | 949 | 102 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 950 | 102 | multiply_may_overflow, narrow_integral>( | 951 | 102 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 952 | 102 | to_precision, to_scale, min_result, max_result, multiplier, | 953 | 102 | params)) { | 954 | 102 | if (set_nullable) { | 955 | 102 | null_map_data[i] = 1; | 956 | 102 | } else { | 957 | 102 | return params.status; | 958 | 102 | } | 959 | 102 | } | 960 | 102 | } | 961 | 102 | return Status::OK(); | 962 | 102 | }, | 963 | 102 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 964 | 102 | if (narrow_integral) { | 965 | 28 | block.get_by_position(result).column = | 966 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 967 | 74 | } else { | 968 | 74 | block.get_by_position(result).column = std::move(col_to); | 969 | 74 | } | 970 | 102 | return Status::OK(); | 971 | 102 | } |
|
972 | | }; |
973 | | |
974 | | // cast between decimalv3 types |
975 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
976 | | requires(IsDataTypeDecimalV3<ToDataType> && IsDataTypeDecimalV3<FromDataType>) |
977 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
978 | | public: |
979 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
980 | | uint32_t result, size_t input_rows_count, |
981 | 4.27k | const NullMap::value_type* null_map = nullptr) const override { |
982 | 4.27k | using FromFieldType = typename FromDataType::FieldType; |
983 | 4.27k | using ToFieldType = typename ToDataType::FieldType; |
984 | 4.27k | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
985 | 4.27k | const auto* col_from = |
986 | 4.27k | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
987 | 4.27k | if (!col_from) { |
988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
989 | 0 | named_from.column->get_name()); |
990 | 0 | } |
991 | | |
992 | 4.27k | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); |
993 | 4.27k | UInt32 from_precision = from_decimal_type.get_precision(); |
994 | 4.27k | UInt32 from_scale = from_decimal_type.get_scale(); |
995 | | |
996 | 4.27k | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
997 | 4.27k | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
998 | 4.27k | UInt32 to_precision = to_decimal_type.get_precision(); |
999 | 4.27k | ToDataType::check_type_precision(to_precision); |
1000 | 4.27k | UInt32 to_scale = to_decimal_type.get_scale(); |
1001 | 4.27k | ToDataType::check_type_scale(to_scale); |
1002 | | |
1003 | 4.27k | auto from_max_int_digit_count = from_precision - from_scale; |
1004 | 4.27k | auto to_max_int_digit_count = to_precision - to_scale; |
1005 | 4.27k | bool narrow_integral = |
1006 | 4.27k | (to_max_int_digit_count < from_max_int_digit_count) || |
1007 | 4.27k | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
1008 | | // only in non-strict mode and may overflow, we set nullable |
1009 | 4.27k | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
1010 | | |
1011 | 4.27k | size_t size = col_from->size(); |
1012 | 4.27k | ColumnUInt8::MutablePtr col_null_map_to; |
1013 | 4.27k | NullMap::value_type* null_map_data = nullptr; |
1014 | 4.27k | if (narrow_integral) { |
1015 | 3.10k | col_null_map_to = ColumnUInt8::create(size, 0); |
1016 | 3.10k | null_map_data = col_null_map_to->get_data().data(); |
1017 | 3.10k | } |
1018 | 4.27k | CastParameters params; |
1019 | 4.27k | params.is_strict = (CastMode == CastModeType::StrictMode); |
1020 | 4.27k | auto col_to = ToDataType::ColumnType::create(size, to_scale); |
1021 | 4.27k | const auto& vec_from = col_from->get_data(); |
1022 | 4.27k | const auto* vec_from_data = vec_from.data(); |
1023 | 4.27k | auto& vec_to = col_to->get_data(); |
1024 | 4.27k | auto* vec_to_data = vec_to.data(); |
1025 | | |
1026 | 4.27k | using MaxFieldType = |
1027 | 4.27k | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && |
1028 | 4.27k | (std::is_same_v<ToFieldType, Decimal128V3> || |
1029 | 4.27k | std::is_same_v<FromFieldType, Decimal128V3>), |
1030 | 4.27k | Decimal128V3, |
1031 | 4.27k | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), |
1032 | 4.27k | FromFieldType, ToFieldType>>; |
1033 | 4.27k | using MaxNativeType = typename MaxFieldType::NativeType; |
1034 | | |
1035 | 4.27k | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
1036 | 4.27k | bool multiply_may_overflow = false; |
1037 | 4.27k | if (to_scale > from_scale) { |
1038 | 1.95k | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
1039 | 1.95k | } |
1040 | | |
1041 | 4.27k | typename ToFieldType::NativeType max_result = |
1042 | 4.27k | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
1043 | 4.27k | typename ToFieldType::NativeType min_result = -max_result; |
1044 | | |
1045 | 4.27k | MaxNativeType multiplier {}; |
1046 | 4.27k | if (from_scale < to_scale) { |
1047 | 1.95k | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
1048 | 1.95k | from_scale); |
1049 | 2.31k | } else if (from_scale > to_scale) { |
1050 | 1.51k | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
1051 | 1.51k | to_scale); |
1052 | 1.51k | } |
1053 | 4.27k | RETURN_IF_ERROR(std::visit( |
1054 | 4.27k | [&](auto multiply_may_overflow, auto narrow_integral) { |
1055 | 4.27k | for (size_t i = 0; i < size; i++) { |
1056 | 4.27k | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, |
1057 | 4.27k | multiply_may_overflow, narrow_integral>( |
1058 | 4.27k | vec_from_data[i], from_precision, from_scale, vec_to_data[i], |
1059 | 4.27k | to_precision, to_scale, min_result, max_result, multiplier, |
1060 | 4.27k | params)) { |
1061 | 4.27k | if (set_nullable) { |
1062 | 4.27k | null_map_data[i] = 1; |
1063 | 4.27k | } else { |
1064 | 4.27k | return params.status; |
1065 | 4.27k | } |
1066 | 4.27k | } |
1067 | 4.27k | } |
1068 | 4.27k | return Status::OK(); |
1069 | 4.27k | }, |
1070 | 4.27k | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
1071 | 2.77k | if (narrow_integral) { |
1072 | 1.60k | block.get_by_position(result).column = |
1073 | 1.60k | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
1074 | 1.60k | } else { |
1075 | 1.17k | block.get_by_position(result).column = std::move(col_to); |
1076 | 1.17k | } |
1077 | 2.77k | return Status::OK(); |
1078 | 4.27k | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 53 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 53 | using FromFieldType = typename FromDataType::FieldType; | 983 | 53 | using ToFieldType = typename ToDataType::FieldType; | 984 | 53 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 53 | const auto* col_from = | 986 | 53 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 53 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 53 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 53 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 53 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 53 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 53 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 53 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 53 | ToDataType::check_type_precision(to_precision); | 1000 | 53 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 53 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 53 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 53 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 53 | bool narrow_integral = | 1006 | 53 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 53 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 53 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 53 | size_t size = col_from->size(); | 1012 | 53 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 53 | NullMap::value_type* null_map_data = nullptr; | 1014 | 53 | if (narrow_integral) { | 1015 | 53 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 53 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 53 | } | 1018 | 53 | CastParameters params; | 1019 | 53 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 53 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 53 | const auto& vec_from = col_from->get_data(); | 1022 | 53 | const auto* vec_from_data = vec_from.data(); | 1023 | 53 | auto& vec_to = col_to->get_data(); | 1024 | 53 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 53 | using MaxFieldType = | 1027 | 53 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 53 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 53 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 53 | Decimal128V3, | 1031 | 53 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 53 | FromFieldType, ToFieldType>>; | 1033 | 53 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 53 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 53 | bool multiply_may_overflow = false; | 1037 | 53 | if (to_scale > from_scale) { | 1038 | 27 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 27 | } | 1040 | | | 1041 | 53 | typename ToFieldType::NativeType max_result = | 1042 | 53 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 53 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 53 | MaxNativeType multiplier {}; | 1046 | 53 | if (from_scale < to_scale) { | 1047 | 27 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 27 | from_scale); | 1049 | 27 | } else if (from_scale > to_scale) { | 1050 | 20 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 20 | to_scale); | 1052 | 20 | } | 1053 | 53 | RETURN_IF_ERROR(std::visit( | 1054 | 53 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 53 | for (size_t i = 0; i < size; i++) { | 1056 | 53 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 53 | multiply_may_overflow, narrow_integral>( | 1058 | 53 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 53 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 53 | params)) { | 1061 | 53 | if (set_nullable) { | 1062 | 53 | null_map_data[i] = 1; | 1063 | 53 | } else { | 1064 | 53 | return params.status; | 1065 | 53 | } | 1066 | 53 | } | 1067 | 53 | } | 1068 | 53 | return Status::OK(); | 1069 | 53 | }, | 1070 | 53 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 53 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 75 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 75 | using FromFieldType = typename FromDataType::FieldType; | 983 | 75 | using ToFieldType = typename ToDataType::FieldType; | 984 | 75 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 75 | const auto* col_from = | 986 | 75 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 75 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 75 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 75 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 75 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 75 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 75 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 75 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 75 | ToDataType::check_type_precision(to_precision); | 1000 | 75 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 75 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 75 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 75 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 75 | bool narrow_integral = | 1006 | 75 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 75 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 75 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 75 | size_t size = col_from->size(); | 1012 | 75 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 75 | NullMap::value_type* null_map_data = nullptr; | 1014 | 75 | if (narrow_integral) { | 1015 | 45 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 45 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 45 | } | 1018 | 75 | CastParameters params; | 1019 | 75 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 75 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 75 | const auto& vec_from = col_from->get_data(); | 1022 | 75 | const auto* vec_from_data = vec_from.data(); | 1023 | 75 | auto& vec_to = col_to->get_data(); | 1024 | 75 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 75 | using MaxFieldType = | 1027 | 75 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 75 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 75 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 75 | Decimal128V3, | 1031 | 75 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 75 | FromFieldType, ToFieldType>>; | 1033 | 75 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 75 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 75 | bool multiply_may_overflow = false; | 1037 | 75 | if (to_scale > from_scale) { | 1038 | 35 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 35 | } | 1040 | | | 1041 | 75 | typename ToFieldType::NativeType max_result = | 1042 | 75 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 75 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 75 | MaxNativeType multiplier {}; | 1046 | 75 | if (from_scale < to_scale) { | 1047 | 35 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 35 | from_scale); | 1049 | 40 | } else if (from_scale > to_scale) { | 1050 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 30 | to_scale); | 1052 | 30 | } | 1053 | 75 | RETURN_IF_ERROR(std::visit( | 1054 | 75 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 75 | for (size_t i = 0; i < size; i++) { | 1056 | 75 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 75 | multiply_may_overflow, narrow_integral>( | 1058 | 75 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 75 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 75 | params)) { | 1061 | 75 | if (set_nullable) { | 1062 | 75 | null_map_data[i] = 1; | 1063 | 75 | } else { | 1064 | 75 | return params.status; | 1065 | 75 | } | 1066 | 75 | } | 1067 | 75 | } | 1068 | 75 | return Status::OK(); | 1069 | 75 | }, | 1070 | 75 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 75 | if (narrow_integral) { | 1072 | 45 | block.get_by_position(result).column = | 1073 | 45 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 45 | } else { | 1075 | 30 | block.get_by_position(result).column = std::move(col_to); | 1076 | 30 | } | 1077 | 75 | return Status::OK(); | 1078 | 75 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 129 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 129 | using FromFieldType = typename FromDataType::FieldType; | 983 | 129 | using ToFieldType = typename ToDataType::FieldType; | 984 | 129 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 129 | const auto* col_from = | 986 | 129 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 129 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 129 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 129 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 129 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 129 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 129 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 129 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 129 | ToDataType::check_type_precision(to_precision); | 1000 | 129 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 129 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 129 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 129 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 129 | bool narrow_integral = | 1006 | 129 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 129 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 129 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 129 | size_t size = col_from->size(); | 1012 | 129 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 129 | NullMap::value_type* null_map_data = nullptr; | 1014 | 129 | if (narrow_integral) { | 1015 | 129 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 129 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 129 | } | 1018 | 129 | CastParameters params; | 1019 | 129 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 129 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 129 | const auto& vec_from = col_from->get_data(); | 1022 | 129 | const auto* vec_from_data = vec_from.data(); | 1023 | 129 | auto& vec_to = col_to->get_data(); | 1024 | 129 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 129 | using MaxFieldType = | 1027 | 129 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 129 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 129 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 129 | Decimal128V3, | 1031 | 129 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 129 | FromFieldType, ToFieldType>>; | 1033 | 129 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 129 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 129 | bool multiply_may_overflow = false; | 1037 | 129 | if (to_scale > from_scale) { | 1038 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 36 | } | 1040 | | | 1041 | 129 | typename ToFieldType::NativeType max_result = | 1042 | 129 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 129 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 129 | MaxNativeType multiplier {}; | 1046 | 129 | if (from_scale < to_scale) { | 1047 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 36 | from_scale); | 1049 | 93 | } else if (from_scale > to_scale) { | 1050 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 66 | to_scale); | 1052 | 66 | } | 1053 | 129 | RETURN_IF_ERROR(std::visit( | 1054 | 129 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 129 | for (size_t i = 0; i < size; i++) { | 1056 | 129 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 129 | multiply_may_overflow, narrow_integral>( | 1058 | 129 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 129 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 129 | params)) { | 1061 | 129 | if (set_nullable) { | 1062 | 129 | null_map_data[i] = 1; | 1063 | 129 | } else { | 1064 | 129 | return params.status; | 1065 | 129 | } | 1066 | 129 | } | 1067 | 129 | } | 1068 | 129 | return Status::OK(); | 1069 | 129 | }, | 1070 | 129 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 129 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 156 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 156 | using FromFieldType = typename FromDataType::FieldType; | 983 | 156 | using ToFieldType = typename ToDataType::FieldType; | 984 | 156 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 156 | const auto* col_from = | 986 | 156 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 156 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 156 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 156 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 156 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 156 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 156 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 156 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 156 | ToDataType::check_type_precision(to_precision); | 1000 | 156 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 156 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 156 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 156 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 156 | bool narrow_integral = | 1006 | 156 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 156 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 156 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 156 | size_t size = col_from->size(); | 1012 | 156 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 156 | NullMap::value_type* null_map_data = nullptr; | 1014 | 156 | if (narrow_integral) { | 1015 | 136 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 136 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 136 | } | 1018 | 156 | CastParameters params; | 1019 | 156 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 156 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 156 | const auto& vec_from = col_from->get_data(); | 1022 | 156 | const auto* vec_from_data = vec_from.data(); | 1023 | 156 | auto& vec_to = col_to->get_data(); | 1024 | 156 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 156 | using MaxFieldType = | 1027 | 156 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 156 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 156 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 156 | Decimal128V3, | 1031 | 156 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 156 | FromFieldType, ToFieldType>>; | 1033 | 156 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 156 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 156 | bool multiply_may_overflow = false; | 1037 | 156 | if (to_scale > from_scale) { | 1038 | 42 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 42 | } | 1040 | | | 1041 | 156 | typename ToFieldType::NativeType max_result = | 1042 | 156 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 156 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 156 | MaxNativeType multiplier {}; | 1046 | 156 | if (from_scale < to_scale) { | 1047 | 42 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 42 | from_scale); | 1049 | 114 | } else if (from_scale > to_scale) { | 1050 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 72 | to_scale); | 1052 | 72 | } | 1053 | 156 | RETURN_IF_ERROR(std::visit( | 1054 | 156 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 156 | for (size_t i = 0; i < size; i++) { | 1056 | 156 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 156 | multiply_may_overflow, narrow_integral>( | 1058 | 156 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 156 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 156 | params)) { | 1061 | 156 | if (set_nullable) { | 1062 | 156 | null_map_data[i] = 1; | 1063 | 156 | } else { | 1064 | 156 | return params.status; | 1065 | 156 | } | 1066 | 156 | } | 1067 | 156 | } | 1068 | 156 | return Status::OK(); | 1069 | 156 | }, | 1070 | 156 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 156 | if (narrow_integral) { | 1072 | 136 | block.get_by_position(result).column = | 1073 | 136 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 136 | } else { | 1075 | 20 | block.get_by_position(result).column = std::move(col_to); | 1076 | 20 | } | 1077 | 156 | return Status::OK(); | 1078 | 156 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 140 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 140 | using FromFieldType = typename FromDataType::FieldType; | 983 | 140 | using ToFieldType = typename ToDataType::FieldType; | 984 | 140 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 140 | const auto* col_from = | 986 | 140 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 140 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 140 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 140 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 140 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 140 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 140 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 140 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 140 | ToDataType::check_type_precision(to_precision); | 1000 | 140 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 140 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 140 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 140 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 140 | bool narrow_integral = | 1006 | 140 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 140 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 140 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 140 | size_t size = col_from->size(); | 1012 | 140 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 140 | NullMap::value_type* null_map_data = nullptr; | 1014 | 140 | if (narrow_integral) { | 1015 | 140 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 140 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 140 | } | 1018 | 140 | CastParameters params; | 1019 | 140 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 140 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 140 | const auto& vec_from = col_from->get_data(); | 1022 | 140 | const auto* vec_from_data = vec_from.data(); | 1023 | 140 | auto& vec_to = col_to->get_data(); | 1024 | 140 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 140 | using MaxFieldType = | 1027 | 140 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 140 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 140 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 140 | Decimal128V3, | 1031 | 140 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 140 | FromFieldType, ToFieldType>>; | 1033 | 140 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 140 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 140 | bool multiply_may_overflow = false; | 1037 | 140 | if (to_scale > from_scale) { | 1038 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 36 | } | 1040 | | | 1041 | 140 | typename ToFieldType::NativeType max_result = | 1042 | 140 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 140 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 140 | MaxNativeType multiplier {}; | 1046 | 140 | if (from_scale < to_scale) { | 1047 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 36 | from_scale); | 1049 | 104 | } else if (from_scale > to_scale) { | 1050 | 80 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 80 | to_scale); | 1052 | 80 | } | 1053 | 140 | RETURN_IF_ERROR(std::visit( | 1054 | 140 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 140 | for (size_t i = 0; i < size; i++) { | 1056 | 140 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 140 | multiply_may_overflow, narrow_integral>( | 1058 | 140 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 140 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 140 | params)) { | 1061 | 140 | if (set_nullable) { | 1062 | 140 | null_map_data[i] = 1; | 1063 | 140 | } else { | 1064 | 140 | return params.status; | 1065 | 140 | } | 1066 | 140 | } | 1067 | 140 | } | 1068 | 140 | return Status::OK(); | 1069 | 140 | }, | 1070 | 140 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 140 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 156 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 156 | using FromFieldType = typename FromDataType::FieldType; | 983 | 156 | using ToFieldType = typename ToDataType::FieldType; | 984 | 156 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 156 | const auto* col_from = | 986 | 156 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 156 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 156 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 156 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 156 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 156 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 156 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 156 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 156 | ToDataType::check_type_precision(to_precision); | 1000 | 156 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 156 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 156 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 156 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 156 | bool narrow_integral = | 1006 | 156 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 156 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 156 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 156 | size_t size = col_from->size(); | 1012 | 156 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 156 | NullMap::value_type* null_map_data = nullptr; | 1014 | 156 | if (narrow_integral) { | 1015 | 136 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 136 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 136 | } | 1018 | 156 | CastParameters params; | 1019 | 156 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 156 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 156 | const auto& vec_from = col_from->get_data(); | 1022 | 156 | const auto* vec_from_data = vec_from.data(); | 1023 | 156 | auto& vec_to = col_to->get_data(); | 1024 | 156 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 156 | using MaxFieldType = | 1027 | 156 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 156 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 156 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 156 | Decimal128V3, | 1031 | 156 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 156 | FromFieldType, ToFieldType>>; | 1033 | 156 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 156 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 156 | bool multiply_may_overflow = false; | 1037 | 156 | if (to_scale > from_scale) { | 1038 | 42 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 42 | } | 1040 | | | 1041 | 156 | typename ToFieldType::NativeType max_result = | 1042 | 156 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 156 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 156 | MaxNativeType multiplier {}; | 1046 | 156 | if (from_scale < to_scale) { | 1047 | 42 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 42 | from_scale); | 1049 | 114 | } else if (from_scale > to_scale) { | 1050 | 74 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 74 | to_scale); | 1052 | 74 | } | 1053 | 156 | RETURN_IF_ERROR(std::visit( | 1054 | 156 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 156 | for (size_t i = 0; i < size; i++) { | 1056 | 156 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 156 | multiply_may_overflow, narrow_integral>( | 1058 | 156 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 156 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 156 | params)) { | 1061 | 156 | if (set_nullable) { | 1062 | 156 | null_map_data[i] = 1; | 1063 | 156 | } else { | 1064 | 156 | return params.status; | 1065 | 156 | } | 1066 | 156 | } | 1067 | 156 | } | 1068 | 156 | return Status::OK(); | 1069 | 156 | }, | 1070 | 156 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 156 | if (narrow_integral) { | 1072 | 136 | block.get_by_position(result).column = | 1073 | 136 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 136 | } else { | 1075 | 20 | block.get_by_position(result).column = std::move(col_to); | 1076 | 20 | } | 1077 | 156 | return Status::OK(); | 1078 | 156 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 140 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 140 | using FromFieldType = typename FromDataType::FieldType; | 983 | 140 | using ToFieldType = typename ToDataType::FieldType; | 984 | 140 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 140 | const auto* col_from = | 986 | 140 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 140 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 140 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 140 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 140 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 140 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 140 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 140 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 140 | ToDataType::check_type_precision(to_precision); | 1000 | 140 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 140 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 140 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 140 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 140 | bool narrow_integral = | 1006 | 140 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 140 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 140 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 140 | size_t size = col_from->size(); | 1012 | 140 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 140 | NullMap::value_type* null_map_data = nullptr; | 1014 | 140 | if (narrow_integral) { | 1015 | 140 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 140 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 140 | } | 1018 | 140 | CastParameters params; | 1019 | 140 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 140 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 140 | const auto& vec_from = col_from->get_data(); | 1022 | 140 | const auto* vec_from_data = vec_from.data(); | 1023 | 140 | auto& vec_to = col_to->get_data(); | 1024 | 140 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 140 | using MaxFieldType = | 1027 | 140 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 140 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 140 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 140 | Decimal128V3, | 1031 | 140 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 140 | FromFieldType, ToFieldType>>; | 1033 | 140 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 140 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 140 | bool multiply_may_overflow = false; | 1037 | 140 | if (to_scale > from_scale) { | 1038 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 36 | } | 1040 | | | 1041 | 140 | typename ToFieldType::NativeType max_result = | 1042 | 140 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 140 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 140 | MaxNativeType multiplier {}; | 1046 | 140 | if (from_scale < to_scale) { | 1047 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 36 | from_scale); | 1049 | 104 | } else if (from_scale > to_scale) { | 1050 | 80 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 80 | to_scale); | 1052 | 80 | } | 1053 | 140 | RETURN_IF_ERROR(std::visit( | 1054 | 140 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 140 | for (size_t i = 0; i < size; i++) { | 1056 | 140 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 140 | multiply_may_overflow, narrow_integral>( | 1058 | 140 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 140 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 140 | params)) { | 1061 | 140 | if (set_nullable) { | 1062 | 140 | null_map_data[i] = 1; | 1063 | 140 | } else { | 1064 | 140 | return params.status; | 1065 | 140 | } | 1066 | 140 | } | 1067 | 140 | } | 1068 | 140 | return Status::OK(); | 1069 | 140 | }, | 1070 | 140 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 140 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 156 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 156 | using FromFieldType = typename FromDataType::FieldType; | 983 | 156 | using ToFieldType = typename ToDataType::FieldType; | 984 | 156 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 156 | const auto* col_from = | 986 | 156 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 156 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 156 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 156 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 156 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 156 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 156 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 156 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 156 | ToDataType::check_type_precision(to_precision); | 1000 | 156 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 156 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 156 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 156 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 156 | bool narrow_integral = | 1006 | 156 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 156 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 156 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 156 | size_t size = col_from->size(); | 1012 | 156 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 156 | NullMap::value_type* null_map_data = nullptr; | 1014 | 156 | if (narrow_integral) { | 1015 | 136 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 136 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 136 | } | 1018 | 156 | CastParameters params; | 1019 | 156 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 156 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 156 | const auto& vec_from = col_from->get_data(); | 1022 | 156 | const auto* vec_from_data = vec_from.data(); | 1023 | 156 | auto& vec_to = col_to->get_data(); | 1024 | 156 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 156 | using MaxFieldType = | 1027 | 156 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 156 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 156 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 156 | Decimal128V3, | 1031 | 156 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 156 | FromFieldType, ToFieldType>>; | 1033 | 156 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 156 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 156 | bool multiply_may_overflow = false; | 1037 | 156 | if (to_scale > from_scale) { | 1038 | 42 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 42 | } | 1040 | | | 1041 | 156 | typename ToFieldType::NativeType max_result = | 1042 | 156 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 156 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 156 | MaxNativeType multiplier {}; | 1046 | 156 | if (from_scale < to_scale) { | 1047 | 42 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 42 | from_scale); | 1049 | 114 | } else if (from_scale > to_scale) { | 1050 | 74 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 74 | to_scale); | 1052 | 74 | } | 1053 | 156 | RETURN_IF_ERROR(std::visit( | 1054 | 156 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 156 | for (size_t i = 0; i < size; i++) { | 1056 | 156 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 156 | multiply_may_overflow, narrow_integral>( | 1058 | 156 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 156 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 156 | params)) { | 1061 | 156 | if (set_nullable) { | 1062 | 156 | null_map_data[i] = 1; | 1063 | 156 | } else { | 1064 | 156 | return params.status; | 1065 | 156 | } | 1066 | 156 | } | 1067 | 156 | } | 1068 | 156 | return Status::OK(); | 1069 | 156 | }, | 1070 | 156 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 156 | if (narrow_integral) { | 1072 | 136 | block.get_by_position(result).column = | 1073 | 136 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 136 | } else { | 1075 | 20 | block.get_by_position(result).column = std::move(col_to); | 1076 | 20 | } | 1077 | 156 | return Status::OK(); | 1078 | 156 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 36 | using FromFieldType = typename FromDataType::FieldType; | 983 | 36 | using ToFieldType = typename ToDataType::FieldType; | 984 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 36 | const auto* col_from = | 986 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 36 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 36 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 36 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 36 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 36 | ToDataType::check_type_precision(to_precision); | 1000 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 36 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 36 | bool narrow_integral = | 1006 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 36 | size_t size = col_from->size(); | 1012 | 36 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 36 | NullMap::value_type* null_map_data = nullptr; | 1014 | 36 | if (narrow_integral) { | 1015 | 36 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 36 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 36 | } | 1018 | 36 | CastParameters params; | 1019 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 36 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 36 | const auto& vec_from = col_from->get_data(); | 1022 | 36 | const auto* vec_from_data = vec_from.data(); | 1023 | 36 | auto& vec_to = col_to->get_data(); | 1024 | 36 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 36 | using MaxFieldType = | 1027 | 36 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 36 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 36 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 36 | Decimal128V3, | 1031 | 36 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 36 | FromFieldType, ToFieldType>>; | 1033 | 36 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 36 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 36 | bool multiply_may_overflow = false; | 1037 | 36 | if (to_scale > from_scale) { | 1038 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 36 | } | 1040 | | | 1041 | 36 | typename ToFieldType::NativeType max_result = | 1042 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 36 | MaxNativeType multiplier {}; | 1046 | 36 | if (from_scale < to_scale) { | 1047 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 36 | from_scale); | 1049 | 36 | } else if (from_scale > to_scale) { | 1050 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 0 | to_scale); | 1052 | 0 | } | 1053 | 36 | RETURN_IF_ERROR(std::visit( | 1054 | 36 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 36 | for (size_t i = 0; i < size; i++) { | 1056 | 36 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 36 | multiply_may_overflow, narrow_integral>( | 1058 | 36 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 36 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 36 | params)) { | 1061 | 36 | if (set_nullable) { | 1062 | 36 | null_map_data[i] = 1; | 1063 | 36 | } else { | 1064 | 36 | return params.status; | 1065 | 36 | } | 1066 | 36 | } | 1067 | 36 | } | 1068 | 36 | return Status::OK(); | 1069 | 36 | }, | 1070 | 36 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 132 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 132 | using FromFieldType = typename FromDataType::FieldType; | 983 | 132 | using ToFieldType = typename ToDataType::FieldType; | 984 | 132 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 132 | const auto* col_from = | 986 | 132 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 132 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 132 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 132 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 132 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 132 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 132 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 132 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 132 | ToDataType::check_type_precision(to_precision); | 1000 | 132 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 132 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 132 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 132 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 132 | bool narrow_integral = | 1006 | 132 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 132 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 132 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 132 | size_t size = col_from->size(); | 1012 | 132 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 132 | NullMap::value_type* null_map_data = nullptr; | 1014 | 132 | if (narrow_integral) { | 1015 | 32 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 32 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 32 | } | 1018 | 132 | CastParameters params; | 1019 | 132 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 132 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 132 | const auto& vec_from = col_from->get_data(); | 1022 | 132 | const auto* vec_from_data = vec_from.data(); | 1023 | 132 | auto& vec_to = col_to->get_data(); | 1024 | 132 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 132 | using MaxFieldType = | 1027 | 132 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 132 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 132 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 132 | Decimal128V3, | 1031 | 132 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 132 | FromFieldType, ToFieldType>>; | 1033 | 132 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 132 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 132 | bool multiply_may_overflow = false; | 1037 | 132 | if (to_scale > from_scale) { | 1038 | 69 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 69 | } | 1040 | | | 1041 | 132 | typename ToFieldType::NativeType max_result = | 1042 | 132 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 132 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 132 | MaxNativeType multiplier {}; | 1046 | 132 | if (from_scale < to_scale) { | 1047 | 69 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 69 | from_scale); | 1049 | 69 | } else if (from_scale > to_scale) { | 1050 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 30 | to_scale); | 1052 | 30 | } | 1053 | 132 | RETURN_IF_ERROR(std::visit( | 1054 | 132 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 132 | for (size_t i = 0; i < size; i++) { | 1056 | 132 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 132 | multiply_may_overflow, narrow_integral>( | 1058 | 132 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 132 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 132 | params)) { | 1061 | 132 | if (set_nullable) { | 1062 | 132 | null_map_data[i] = 1; | 1063 | 132 | } else { | 1064 | 132 | return params.status; | 1065 | 132 | } | 1066 | 132 | } | 1067 | 132 | } | 1068 | 132 | return Status::OK(); | 1069 | 132 | }, | 1070 | 132 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 132 | if (narrow_integral) { | 1072 | 32 | block.get_by_position(result).column = | 1073 | 32 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 100 | } else { | 1075 | 100 | block.get_by_position(result).column = std::move(col_to); | 1076 | 100 | } | 1077 | 132 | return Status::OK(); | 1078 | 132 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 92 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 92 | using FromFieldType = typename FromDataType::FieldType; | 983 | 92 | using ToFieldType = typename ToDataType::FieldType; | 984 | 92 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 92 | const auto* col_from = | 986 | 92 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 92 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 92 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 92 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 92 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 92 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 92 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 92 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 92 | ToDataType::check_type_precision(to_precision); | 1000 | 92 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 92 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 92 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 92 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 92 | bool narrow_integral = | 1006 | 92 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 92 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 92 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 92 | size_t size = col_from->size(); | 1012 | 92 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 92 | NullMap::value_type* null_map_data = nullptr; | 1014 | 92 | if (narrow_integral) { | 1015 | 92 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 92 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 92 | } | 1018 | 92 | CastParameters params; | 1019 | 92 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 92 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 92 | const auto& vec_from = col_from->get_data(); | 1022 | 92 | const auto* vec_from_data = vec_from.data(); | 1023 | 92 | auto& vec_to = col_to->get_data(); | 1024 | 92 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 92 | using MaxFieldType = | 1027 | 92 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 92 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 92 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 92 | Decimal128V3, | 1031 | 92 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 92 | FromFieldType, ToFieldType>>; | 1033 | 92 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 92 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 92 | bool multiply_may_overflow = false; | 1037 | 92 | if (to_scale > from_scale) { | 1038 | 66 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 66 | } | 1040 | | | 1041 | 92 | typename ToFieldType::NativeType max_result = | 1042 | 92 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 92 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 92 | MaxNativeType multiplier {}; | 1046 | 92 | if (from_scale < to_scale) { | 1047 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 66 | from_scale); | 1049 | 66 | } else if (from_scale > to_scale) { | 1050 | 20 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 20 | to_scale); | 1052 | 20 | } | 1053 | 92 | RETURN_IF_ERROR(std::visit( | 1054 | 92 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 92 | for (size_t i = 0; i < size; i++) { | 1056 | 92 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 92 | multiply_may_overflow, narrow_integral>( | 1058 | 92 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 92 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 92 | params)) { | 1061 | 92 | if (set_nullable) { | 1062 | 92 | null_map_data[i] = 1; | 1063 | 92 | } else { | 1064 | 92 | return params.status; | 1065 | 92 | } | 1066 | 92 | } | 1067 | 92 | } | 1068 | 92 | return Status::OK(); | 1069 | 92 | }, | 1070 | 92 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 92 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 180 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 180 | using FromFieldType = typename FromDataType::FieldType; | 983 | 180 | using ToFieldType = typename ToDataType::FieldType; | 984 | 180 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 180 | const auto* col_from = | 986 | 180 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 180 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 180 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 180 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 180 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 180 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 180 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 180 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 180 | ToDataType::check_type_precision(to_precision); | 1000 | 180 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 180 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 180 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 180 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 180 | bool narrow_integral = | 1006 | 180 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 180 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 180 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 180 | size_t size = col_from->size(); | 1012 | 180 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 180 | NullMap::value_type* null_map_data = nullptr; | 1014 | 180 | if (narrow_integral) { | 1015 | 104 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 104 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 104 | } | 1018 | 180 | CastParameters params; | 1019 | 180 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 180 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 180 | const auto& vec_from = col_from->get_data(); | 1022 | 180 | const auto* vec_from_data = vec_from.data(); | 1023 | 180 | auto& vec_to = col_to->get_data(); | 1024 | 180 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 180 | using MaxFieldType = | 1027 | 180 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 180 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 180 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 180 | Decimal128V3, | 1031 | 180 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 180 | FromFieldType, ToFieldType>>; | 1033 | 180 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 180 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 180 | bool multiply_may_overflow = false; | 1037 | 180 | if (to_scale > from_scale) { | 1038 | 86 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 86 | } | 1040 | | | 1041 | 180 | typename ToFieldType::NativeType max_result = | 1042 | 180 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 180 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 180 | MaxNativeType multiplier {}; | 1046 | 180 | if (from_scale < to_scale) { | 1047 | 86 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 86 | from_scale); | 1049 | 94 | } else if (from_scale > to_scale) { | 1050 | 68 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 68 | to_scale); | 1052 | 68 | } | 1053 | 180 | RETURN_IF_ERROR(std::visit( | 1054 | 180 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 180 | for (size_t i = 0; i < size; i++) { | 1056 | 180 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 180 | multiply_may_overflow, narrow_integral>( | 1058 | 180 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 180 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 180 | params)) { | 1061 | 180 | if (set_nullable) { | 1062 | 180 | null_map_data[i] = 1; | 1063 | 180 | } else { | 1064 | 180 | return params.status; | 1065 | 180 | } | 1066 | 180 | } | 1067 | 180 | } | 1068 | 180 | return Status::OK(); | 1069 | 180 | }, | 1070 | 180 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 180 | if (narrow_integral) { | 1072 | 104 | block.get_by_position(result).column = | 1073 | 104 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 104 | } else { | 1075 | 76 | block.get_by_position(result).column = std::move(col_to); | 1076 | 76 | } | 1077 | 180 | return Status::OK(); | 1078 | 180 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 153 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 153 | using FromFieldType = typename FromDataType::FieldType; | 983 | 153 | using ToFieldType = typename ToDataType::FieldType; | 984 | 153 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 153 | const auto* col_from = | 986 | 153 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 153 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 153 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 153 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 153 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 153 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 153 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 153 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 153 | ToDataType::check_type_precision(to_precision); | 1000 | 153 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 153 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 153 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 153 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 153 | bool narrow_integral = | 1006 | 153 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 153 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 153 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 153 | size_t size = col_from->size(); | 1012 | 153 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 153 | NullMap::value_type* null_map_data = nullptr; | 1014 | 153 | if (narrow_integral) { | 1015 | 153 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 153 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 153 | } | 1018 | 153 | CastParameters params; | 1019 | 153 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 153 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 153 | const auto& vec_from = col_from->get_data(); | 1022 | 153 | const auto* vec_from_data = vec_from.data(); | 1023 | 153 | auto& vec_to = col_to->get_data(); | 1024 | 153 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 153 | using MaxFieldType = | 1027 | 153 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 153 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 153 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 153 | Decimal128V3, | 1031 | 153 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 153 | FromFieldType, ToFieldType>>; | 1033 | 153 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 153 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 153 | bool multiply_may_overflow = false; | 1037 | 153 | if (to_scale > from_scale) { | 1038 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 60 | } | 1040 | | | 1041 | 153 | typename ToFieldType::NativeType max_result = | 1042 | 153 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 153 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 153 | MaxNativeType multiplier {}; | 1046 | 153 | if (from_scale < to_scale) { | 1047 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 60 | from_scale); | 1049 | 93 | } else if (from_scale > to_scale) { | 1050 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 66 | to_scale); | 1052 | 66 | } | 1053 | 153 | RETURN_IF_ERROR(std::visit( | 1054 | 153 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 153 | for (size_t i = 0; i < size; i++) { | 1056 | 153 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 153 | multiply_may_overflow, narrow_integral>( | 1058 | 153 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 153 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 153 | params)) { | 1061 | 153 | if (set_nullable) { | 1062 | 153 | null_map_data[i] = 1; | 1063 | 153 | } else { | 1064 | 153 | return params.status; | 1065 | 153 | } | 1066 | 153 | } | 1067 | 153 | } | 1068 | 153 | return Status::OK(); | 1069 | 153 | }, | 1070 | 153 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 153 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 228 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 228 | using FromFieldType = typename FromDataType::FieldType; | 983 | 228 | using ToFieldType = typename ToDataType::FieldType; | 984 | 228 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 228 | const auto* col_from = | 986 | 228 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 228 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 228 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 228 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 228 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 228 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 228 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 228 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 228 | ToDataType::check_type_precision(to_precision); | 1000 | 228 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 228 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 228 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 228 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 228 | bool narrow_integral = | 1006 | 228 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 228 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 228 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 228 | size_t size = col_from->size(); | 1012 | 228 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 228 | NullMap::value_type* null_map_data = nullptr; | 1014 | 228 | if (narrow_integral) { | 1015 | 192 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 192 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 192 | } | 1018 | 228 | CastParameters params; | 1019 | 228 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 228 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 228 | const auto& vec_from = col_from->get_data(); | 1022 | 228 | const auto* vec_from_data = vec_from.data(); | 1023 | 228 | auto& vec_to = col_to->get_data(); | 1024 | 228 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 228 | using MaxFieldType = | 1027 | 228 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 228 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 228 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 228 | Decimal128V3, | 1031 | 228 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 228 | FromFieldType, ToFieldType>>; | 1033 | 228 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 228 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 228 | bool multiply_may_overflow = false; | 1037 | 228 | if (to_scale > from_scale) { | 1038 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 76 | } | 1040 | | | 1041 | 228 | typename ToFieldType::NativeType max_result = | 1042 | 228 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 228 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 228 | MaxNativeType multiplier {}; | 1046 | 228 | if (from_scale < to_scale) { | 1047 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 76 | from_scale); | 1049 | 152 | } else if (from_scale > to_scale) { | 1050 | 94 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 94 | to_scale); | 1052 | 94 | } | 1053 | 228 | RETURN_IF_ERROR(std::visit( | 1054 | 228 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 228 | for (size_t i = 0; i < size; i++) { | 1056 | 228 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 228 | multiply_may_overflow, narrow_integral>( | 1058 | 228 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 228 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 228 | params)) { | 1061 | 228 | if (set_nullable) { | 1062 | 228 | null_map_data[i] = 1; | 1063 | 228 | } else { | 1064 | 228 | return params.status; | 1065 | 228 | } | 1066 | 228 | } | 1067 | 228 | } | 1068 | 228 | return Status::OK(); | 1069 | 228 | }, | 1070 | 228 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 228 | if (narrow_integral) { | 1072 | 192 | block.get_by_position(result).column = | 1073 | 192 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 192 | } else { | 1075 | 36 | block.get_by_position(result).column = std::move(col_to); | 1076 | 36 | } | 1077 | 228 | return Status::OK(); | 1078 | 228 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 164 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 164 | using FromFieldType = typename FromDataType::FieldType; | 983 | 164 | using ToFieldType = typename ToDataType::FieldType; | 984 | 164 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 164 | const auto* col_from = | 986 | 164 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 164 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 164 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 164 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 164 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 164 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 164 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 164 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 164 | ToDataType::check_type_precision(to_precision); | 1000 | 164 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 164 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 164 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 164 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 164 | bool narrow_integral = | 1006 | 164 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 164 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 164 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 164 | size_t size = col_from->size(); | 1012 | 164 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 164 | NullMap::value_type* null_map_data = nullptr; | 1014 | 164 | if (narrow_integral) { | 1015 | 164 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 164 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 164 | } | 1018 | 164 | CastParameters params; | 1019 | 164 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 164 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 164 | const auto& vec_from = col_from->get_data(); | 1022 | 164 | const auto* vec_from_data = vec_from.data(); | 1023 | 164 | auto& vec_to = col_to->get_data(); | 1024 | 164 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 164 | using MaxFieldType = | 1027 | 164 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 164 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 164 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 164 | Decimal128V3, | 1031 | 164 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 164 | FromFieldType, ToFieldType>>; | 1033 | 164 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 164 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 164 | bool multiply_may_overflow = false; | 1037 | 164 | if (to_scale > from_scale) { | 1038 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 60 | } | 1040 | | | 1041 | 164 | typename ToFieldType::NativeType max_result = | 1042 | 164 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 164 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 164 | MaxNativeType multiplier {}; | 1046 | 164 | if (from_scale < to_scale) { | 1047 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 60 | from_scale); | 1049 | 104 | } else if (from_scale > to_scale) { | 1050 | 80 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 80 | to_scale); | 1052 | 80 | } | 1053 | 164 | RETURN_IF_ERROR(std::visit( | 1054 | 164 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 164 | for (size_t i = 0; i < size; i++) { | 1056 | 164 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 164 | multiply_may_overflow, narrow_integral>( | 1058 | 164 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 164 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 164 | params)) { | 1061 | 164 | if (set_nullable) { | 1062 | 164 | null_map_data[i] = 1; | 1063 | 164 | } else { | 1064 | 164 | return params.status; | 1065 | 164 | } | 1066 | 164 | } | 1067 | 164 | } | 1068 | 164 | return Status::OK(); | 1069 | 164 | }, | 1070 | 164 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 164 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 228 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 228 | using FromFieldType = typename FromDataType::FieldType; | 983 | 228 | using ToFieldType = typename ToDataType::FieldType; | 984 | 228 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 228 | const auto* col_from = | 986 | 228 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 228 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 228 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 228 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 228 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 228 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 228 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 228 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 228 | ToDataType::check_type_precision(to_precision); | 1000 | 228 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 228 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 228 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 228 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 228 | bool narrow_integral = | 1006 | 228 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 228 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 228 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 228 | size_t size = col_from->size(); | 1012 | 228 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 228 | NullMap::value_type* null_map_data = nullptr; | 1014 | 228 | if (narrow_integral) { | 1015 | 192 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 192 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 192 | } | 1018 | 228 | CastParameters params; | 1019 | 228 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 228 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 228 | const auto& vec_from = col_from->get_data(); | 1022 | 228 | const auto* vec_from_data = vec_from.data(); | 1023 | 228 | auto& vec_to = col_to->get_data(); | 1024 | 228 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 228 | using MaxFieldType = | 1027 | 228 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 228 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 228 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 228 | Decimal128V3, | 1031 | 228 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 228 | FromFieldType, ToFieldType>>; | 1033 | 228 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 228 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 228 | bool multiply_may_overflow = false; | 1037 | 228 | if (to_scale > from_scale) { | 1038 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 76 | } | 1040 | | | 1041 | 228 | typename ToFieldType::NativeType max_result = | 1042 | 228 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 228 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 228 | MaxNativeType multiplier {}; | 1046 | 228 | if (from_scale < to_scale) { | 1047 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 76 | from_scale); | 1049 | 152 | } else if (from_scale > to_scale) { | 1050 | 96 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 96 | to_scale); | 1052 | 96 | } | 1053 | 228 | RETURN_IF_ERROR(std::visit( | 1054 | 228 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 228 | for (size_t i = 0; i < size; i++) { | 1056 | 228 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 228 | multiply_may_overflow, narrow_integral>( | 1058 | 228 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 228 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 228 | params)) { | 1061 | 228 | if (set_nullable) { | 1062 | 228 | null_map_data[i] = 1; | 1063 | 228 | } else { | 1064 | 228 | return params.status; | 1065 | 228 | } | 1066 | 228 | } | 1067 | 228 | } | 1068 | 228 | return Status::OK(); | 1069 | 228 | }, | 1070 | 228 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 228 | if (narrow_integral) { | 1072 | 192 | block.get_by_position(result).column = | 1073 | 192 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 192 | } else { | 1075 | 36 | block.get_by_position(result).column = std::move(col_to); | 1076 | 36 | } | 1077 | 228 | return Status::OK(); | 1078 | 228 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 36 | using FromFieldType = typename FromDataType::FieldType; | 983 | 36 | using ToFieldType = typename ToDataType::FieldType; | 984 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 36 | const auto* col_from = | 986 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 36 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 36 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 36 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 36 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 36 | ToDataType::check_type_precision(to_precision); | 1000 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 36 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 36 | bool narrow_integral = | 1006 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 36 | size_t size = col_from->size(); | 1012 | 36 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 36 | NullMap::value_type* null_map_data = nullptr; | 1014 | 36 | if (narrow_integral) { | 1015 | 36 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 36 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 36 | } | 1018 | 36 | CastParameters params; | 1019 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 36 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 36 | const auto& vec_from = col_from->get_data(); | 1022 | 36 | const auto* vec_from_data = vec_from.data(); | 1023 | 36 | auto& vec_to = col_to->get_data(); | 1024 | 36 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 36 | using MaxFieldType = | 1027 | 36 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 36 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 36 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 36 | Decimal128V3, | 1031 | 36 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 36 | FromFieldType, ToFieldType>>; | 1033 | 36 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 36 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 36 | bool multiply_may_overflow = false; | 1037 | 36 | if (to_scale > from_scale) { | 1038 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 36 | } | 1040 | | | 1041 | 36 | typename ToFieldType::NativeType max_result = | 1042 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 36 | MaxNativeType multiplier {}; | 1046 | 36 | if (from_scale < to_scale) { | 1047 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 36 | from_scale); | 1049 | 36 | } else if (from_scale > to_scale) { | 1050 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 0 | to_scale); | 1052 | 0 | } | 1053 | 36 | RETURN_IF_ERROR(std::visit( | 1054 | 36 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 36 | for (size_t i = 0; i < size; i++) { | 1056 | 36 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 36 | multiply_may_overflow, narrow_integral>( | 1058 | 36 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 36 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 36 | params)) { | 1061 | 36 | if (set_nullable) { | 1062 | 36 | null_map_data[i] = 1; | 1063 | 36 | } else { | 1064 | 36 | return params.status; | 1065 | 36 | } | 1066 | 36 | } | 1067 | 36 | } | 1068 | 36 | return Status::OK(); | 1069 | 36 | }, | 1070 | 36 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 132 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 132 | using FromFieldType = typename FromDataType::FieldType; | 983 | 132 | using ToFieldType = typename ToDataType::FieldType; | 984 | 132 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 132 | const auto* col_from = | 986 | 132 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 132 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 132 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 132 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 132 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 132 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 132 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 132 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 132 | ToDataType::check_type_precision(to_precision); | 1000 | 132 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 132 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 132 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 132 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 132 | bool narrow_integral = | 1006 | 132 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 132 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 132 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 132 | size_t size = col_from->size(); | 1012 | 132 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 132 | NullMap::value_type* null_map_data = nullptr; | 1014 | 132 | if (narrow_integral) { | 1015 | 32 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 32 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 32 | } | 1018 | 132 | CastParameters params; | 1019 | 132 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 132 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 132 | const auto& vec_from = col_from->get_data(); | 1022 | 132 | const auto* vec_from_data = vec_from.data(); | 1023 | 132 | auto& vec_to = col_to->get_data(); | 1024 | 132 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 132 | using MaxFieldType = | 1027 | 132 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 132 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 132 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 132 | Decimal128V3, | 1031 | 132 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 132 | FromFieldType, ToFieldType>>; | 1033 | 132 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 132 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 132 | bool multiply_may_overflow = false; | 1037 | 132 | if (to_scale > from_scale) { | 1038 | 70 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 70 | } | 1040 | | | 1041 | 132 | typename ToFieldType::NativeType max_result = | 1042 | 132 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 132 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 132 | MaxNativeType multiplier {}; | 1046 | 132 | if (from_scale < to_scale) { | 1047 | 70 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 70 | from_scale); | 1049 | 70 | } else if (from_scale > to_scale) { | 1050 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 30 | to_scale); | 1052 | 30 | } | 1053 | 132 | RETURN_IF_ERROR(std::visit( | 1054 | 132 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 132 | for (size_t i = 0; i < size; i++) { | 1056 | 132 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 132 | multiply_may_overflow, narrow_integral>( | 1058 | 132 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 132 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 132 | params)) { | 1061 | 132 | if (set_nullable) { | 1062 | 132 | null_map_data[i] = 1; | 1063 | 132 | } else { | 1064 | 132 | return params.status; | 1065 | 132 | } | 1066 | 132 | } | 1067 | 132 | } | 1068 | 132 | return Status::OK(); | 1069 | 132 | }, | 1070 | 132 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 132 | if (narrow_integral) { | 1072 | 32 | block.get_by_position(result).column = | 1073 | 32 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 100 | } else { | 1075 | 100 | block.get_by_position(result).column = std::move(col_to); | 1076 | 100 | } | 1077 | 132 | return Status::OK(); | 1078 | 132 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 60 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 60 | using FromFieldType = typename FromDataType::FieldType; | 983 | 60 | using ToFieldType = typename ToDataType::FieldType; | 984 | 60 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 60 | const auto* col_from = | 986 | 60 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 60 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 60 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 60 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 60 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 60 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 60 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 60 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 60 | ToDataType::check_type_precision(to_precision); | 1000 | 60 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 60 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 60 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 60 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 60 | bool narrow_integral = | 1006 | 60 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 60 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 60 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 60 | size_t size = col_from->size(); | 1012 | 60 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 60 | NullMap::value_type* null_map_data = nullptr; | 1014 | 60 | if (narrow_integral) { | 1015 | 60 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 60 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 60 | } | 1018 | 60 | CastParameters params; | 1019 | 60 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 60 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 60 | const auto& vec_from = col_from->get_data(); | 1022 | 60 | const auto* vec_from_data = vec_from.data(); | 1023 | 60 | auto& vec_to = col_to->get_data(); | 1024 | 60 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 60 | using MaxFieldType = | 1027 | 60 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 60 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 60 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 60 | Decimal128V3, | 1031 | 60 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 60 | FromFieldType, ToFieldType>>; | 1033 | 60 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 60 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 60 | bool multiply_may_overflow = false; | 1037 | 60 | if (to_scale > from_scale) { | 1038 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 60 | } | 1040 | | | 1041 | 60 | typename ToFieldType::NativeType max_result = | 1042 | 60 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 60 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 60 | MaxNativeType multiplier {}; | 1046 | 60 | if (from_scale < to_scale) { | 1047 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 60 | from_scale); | 1049 | 60 | } else if (from_scale > to_scale) { | 1050 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 0 | to_scale); | 1052 | 0 | } | 1053 | 60 | RETURN_IF_ERROR(std::visit( | 1054 | 60 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 60 | for (size_t i = 0; i < size; i++) { | 1056 | 60 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 60 | multiply_may_overflow, narrow_integral>( | 1058 | 60 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 60 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 60 | params)) { | 1061 | 60 | if (set_nullable) { | 1062 | 60 | null_map_data[i] = 1; | 1063 | 60 | } else { | 1064 | 60 | return params.status; | 1065 | 60 | } | 1066 | 60 | } | 1067 | 60 | } | 1068 | 60 | return Status::OK(); | 1069 | 60 | }, | 1070 | 60 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 60 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 204 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 204 | using FromFieldType = typename FromDataType::FieldType; | 983 | 204 | using ToFieldType = typename ToDataType::FieldType; | 984 | 204 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 204 | const auto* col_from = | 986 | 204 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 204 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 204 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 204 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 204 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 204 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 204 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 204 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 204 | ToDataType::check_type_precision(to_precision); | 1000 | 204 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 204 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 204 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 204 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 204 | bool narrow_integral = | 1006 | 204 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 204 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 204 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 204 | size_t size = col_from->size(); | 1012 | 204 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 204 | NullMap::value_type* null_map_data = nullptr; | 1014 | 204 | if (narrow_integral) { | 1015 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 56 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 56 | } | 1018 | 204 | CastParameters params; | 1019 | 204 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 204 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 204 | const auto& vec_from = col_from->get_data(); | 1022 | 204 | const auto* vec_from_data = vec_from.data(); | 1023 | 204 | auto& vec_to = col_to->get_data(); | 1024 | 204 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 204 | using MaxFieldType = | 1027 | 204 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 204 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 204 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 204 | Decimal128V3, | 1031 | 204 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 204 | FromFieldType, ToFieldType>>; | 1033 | 204 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 204 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 204 | bool multiply_may_overflow = false; | 1037 | 204 | if (to_scale > from_scale) { | 1038 | 99 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 99 | } | 1040 | | | 1041 | 204 | typename ToFieldType::NativeType max_result = | 1042 | 204 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 204 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 204 | MaxNativeType multiplier {}; | 1046 | 204 | if (from_scale < to_scale) { | 1047 | 99 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 99 | from_scale); | 1049 | 105 | } else if (from_scale > to_scale) { | 1050 | 56 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 56 | to_scale); | 1052 | 56 | } | 1053 | 204 | RETURN_IF_ERROR(std::visit( | 1054 | 204 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 204 | for (size_t i = 0; i < size; i++) { | 1056 | 204 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 204 | multiply_may_overflow, narrow_integral>( | 1058 | 204 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 204 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 204 | params)) { | 1061 | 204 | if (set_nullable) { | 1062 | 204 | null_map_data[i] = 1; | 1063 | 204 | } else { | 1064 | 204 | return params.status; | 1065 | 204 | } | 1066 | 204 | } | 1067 | 204 | } | 1068 | 204 | return Status::OK(); | 1069 | 204 | }, | 1070 | 204 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 204 | if (narrow_integral) { | 1072 | 56 | block.get_by_position(result).column = | 1073 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 148 | } else { | 1075 | 148 | block.get_by_position(result).column = std::move(col_to); | 1076 | 148 | } | 1077 | 204 | return Status::OK(); | 1078 | 204 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 92 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 92 | using FromFieldType = typename FromDataType::FieldType; | 983 | 92 | using ToFieldType = typename ToDataType::FieldType; | 984 | 92 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 92 | const auto* col_from = | 986 | 92 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 92 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 92 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 92 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 92 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 92 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 92 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 92 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 92 | ToDataType::check_type_precision(to_precision); | 1000 | 92 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 92 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 92 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 92 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 92 | bool narrow_integral = | 1006 | 92 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 92 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 92 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 92 | size_t size = col_from->size(); | 1012 | 92 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 92 | NullMap::value_type* null_map_data = nullptr; | 1014 | 92 | if (narrow_integral) { | 1015 | 92 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 92 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 92 | } | 1018 | 92 | CastParameters params; | 1019 | 92 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 92 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 92 | const auto& vec_from = col_from->get_data(); | 1022 | 92 | const auto* vec_from_data = vec_from.data(); | 1023 | 92 | auto& vec_to = col_to->get_data(); | 1024 | 92 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 92 | using MaxFieldType = | 1027 | 92 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 92 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 92 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 92 | Decimal128V3, | 1031 | 92 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 92 | FromFieldType, ToFieldType>>; | 1033 | 92 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 92 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 92 | bool multiply_may_overflow = false; | 1037 | 92 | if (to_scale > from_scale) { | 1038 | 66 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 66 | } | 1040 | | | 1041 | 92 | typename ToFieldType::NativeType max_result = | 1042 | 92 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 92 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 92 | MaxNativeType multiplier {}; | 1046 | 92 | if (from_scale < to_scale) { | 1047 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 66 | from_scale); | 1049 | 66 | } else if (from_scale > to_scale) { | 1050 | 20 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 20 | to_scale); | 1052 | 20 | } | 1053 | 92 | RETURN_IF_ERROR(std::visit( | 1054 | 92 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 92 | for (size_t i = 0; i < size; i++) { | 1056 | 92 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 92 | multiply_may_overflow, narrow_integral>( | 1058 | 92 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 92 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 92 | params)) { | 1061 | 92 | if (set_nullable) { | 1062 | 92 | null_map_data[i] = 1; | 1063 | 92 | } else { | 1064 | 92 | return params.status; | 1065 | 92 | } | 1066 | 92 | } | 1067 | 92 | } | 1068 | 92 | return Status::OK(); | 1069 | 92 | }, | 1070 | 92 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 92 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 180 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 180 | using FromFieldType = typename FromDataType::FieldType; | 983 | 180 | using ToFieldType = typename ToDataType::FieldType; | 984 | 180 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 180 | const auto* col_from = | 986 | 180 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 180 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 180 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 180 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 180 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 180 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 180 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 180 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 180 | ToDataType::check_type_precision(to_precision); | 1000 | 180 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 180 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 180 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 180 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 180 | bool narrow_integral = | 1006 | 180 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 180 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 180 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 180 | size_t size = col_from->size(); | 1012 | 180 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 180 | NullMap::value_type* null_map_data = nullptr; | 1014 | 180 | if (narrow_integral) { | 1015 | 104 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 104 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 104 | } | 1018 | 180 | CastParameters params; | 1019 | 180 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 180 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 180 | const auto& vec_from = col_from->get_data(); | 1022 | 180 | const auto* vec_from_data = vec_from.data(); | 1023 | 180 | auto& vec_to = col_to->get_data(); | 1024 | 180 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 180 | using MaxFieldType = | 1027 | 180 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 180 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 180 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 180 | Decimal128V3, | 1031 | 180 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 180 | FromFieldType, ToFieldType>>; | 1033 | 180 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 180 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 180 | bool multiply_may_overflow = false; | 1037 | 180 | if (to_scale > from_scale) { | 1038 | 86 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 86 | } | 1040 | | | 1041 | 180 | typename ToFieldType::NativeType max_result = | 1042 | 180 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 180 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 180 | MaxNativeType multiplier {}; | 1046 | 180 | if (from_scale < to_scale) { | 1047 | 86 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 86 | from_scale); | 1049 | 94 | } else if (from_scale > to_scale) { | 1050 | 68 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 68 | to_scale); | 1052 | 68 | } | 1053 | 180 | RETURN_IF_ERROR(std::visit( | 1054 | 180 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 180 | for (size_t i = 0; i < size; i++) { | 1056 | 180 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 180 | multiply_may_overflow, narrow_integral>( | 1058 | 180 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 180 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 180 | params)) { | 1061 | 180 | if (set_nullable) { | 1062 | 180 | null_map_data[i] = 1; | 1063 | 180 | } else { | 1064 | 180 | return params.status; | 1065 | 180 | } | 1066 | 180 | } | 1067 | 180 | } | 1068 | 180 | return Status::OK(); | 1069 | 180 | }, | 1070 | 180 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 180 | if (narrow_integral) { | 1072 | 104 | block.get_by_position(result).column = | 1073 | 104 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 104 | } else { | 1075 | 76 | block.get_by_position(result).column = std::move(col_to); | 1076 | 76 | } | 1077 | 180 | return Status::OK(); | 1078 | 180 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 153 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 153 | using FromFieldType = typename FromDataType::FieldType; | 983 | 153 | using ToFieldType = typename ToDataType::FieldType; | 984 | 153 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 153 | const auto* col_from = | 986 | 153 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 153 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 153 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 153 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 153 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 153 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 153 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 153 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 153 | ToDataType::check_type_precision(to_precision); | 1000 | 153 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 153 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 153 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 153 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 153 | bool narrow_integral = | 1006 | 153 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 153 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 153 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 153 | size_t size = col_from->size(); | 1012 | 153 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 153 | NullMap::value_type* null_map_data = nullptr; | 1014 | 153 | if (narrow_integral) { | 1015 | 153 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 153 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 153 | } | 1018 | 153 | CastParameters params; | 1019 | 153 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 153 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 153 | const auto& vec_from = col_from->get_data(); | 1022 | 153 | const auto* vec_from_data = vec_from.data(); | 1023 | 153 | auto& vec_to = col_to->get_data(); | 1024 | 153 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 153 | using MaxFieldType = | 1027 | 153 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 153 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 153 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 153 | Decimal128V3, | 1031 | 153 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 153 | FromFieldType, ToFieldType>>; | 1033 | 153 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 153 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 153 | bool multiply_may_overflow = false; | 1037 | 153 | if (to_scale > from_scale) { | 1038 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 60 | } | 1040 | | | 1041 | 153 | typename ToFieldType::NativeType max_result = | 1042 | 153 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 153 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 153 | MaxNativeType multiplier {}; | 1046 | 153 | if (from_scale < to_scale) { | 1047 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 60 | from_scale); | 1049 | 93 | } else if (from_scale > to_scale) { | 1050 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 66 | to_scale); | 1052 | 66 | } | 1053 | 153 | RETURN_IF_ERROR(std::visit( | 1054 | 153 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 153 | for (size_t i = 0; i < size; i++) { | 1056 | 153 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 153 | multiply_may_overflow, narrow_integral>( | 1058 | 153 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 153 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 153 | params)) { | 1061 | 153 | if (set_nullable) { | 1062 | 153 | null_map_data[i] = 1; | 1063 | 153 | } else { | 1064 | 153 | return params.status; | 1065 | 153 | } | 1066 | 153 | } | 1067 | 153 | } | 1068 | 153 | return Status::OK(); | 1069 | 153 | }, | 1070 | 153 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 153 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 228 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 228 | using FromFieldType = typename FromDataType::FieldType; | 983 | 228 | using ToFieldType = typename ToDataType::FieldType; | 984 | 228 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 228 | const auto* col_from = | 986 | 228 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 228 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 228 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 228 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 228 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 228 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 228 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 228 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 228 | ToDataType::check_type_precision(to_precision); | 1000 | 228 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 228 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 228 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 228 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 228 | bool narrow_integral = | 1006 | 228 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 228 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 228 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 228 | size_t size = col_from->size(); | 1012 | 228 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 228 | NullMap::value_type* null_map_data = nullptr; | 1014 | 228 | if (narrow_integral) { | 1015 | 192 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 192 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 192 | } | 1018 | 228 | CastParameters params; | 1019 | 228 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 228 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 228 | const auto& vec_from = col_from->get_data(); | 1022 | 228 | const auto* vec_from_data = vec_from.data(); | 1023 | 228 | auto& vec_to = col_to->get_data(); | 1024 | 228 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 228 | using MaxFieldType = | 1027 | 228 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 228 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 228 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 228 | Decimal128V3, | 1031 | 228 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 228 | FromFieldType, ToFieldType>>; | 1033 | 228 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 228 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 228 | bool multiply_may_overflow = false; | 1037 | 228 | if (to_scale > from_scale) { | 1038 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 76 | } | 1040 | | | 1041 | 228 | typename ToFieldType::NativeType max_result = | 1042 | 228 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 228 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 228 | MaxNativeType multiplier {}; | 1046 | 228 | if (from_scale < to_scale) { | 1047 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 76 | from_scale); | 1049 | 152 | } else if (from_scale > to_scale) { | 1050 | 94 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 94 | to_scale); | 1052 | 94 | } | 1053 | 228 | RETURN_IF_ERROR(std::visit( | 1054 | 228 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 228 | for (size_t i = 0; i < size; i++) { | 1056 | 228 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 228 | multiply_may_overflow, narrow_integral>( | 1058 | 228 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 228 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 228 | params)) { | 1061 | 228 | if (set_nullable) { | 1062 | 228 | null_map_data[i] = 1; | 1063 | 228 | } else { | 1064 | 228 | return params.status; | 1065 | 228 | } | 1066 | 228 | } | 1067 | 228 | } | 1068 | 228 | return Status::OK(); | 1069 | 228 | }, | 1070 | 228 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 228 | if (narrow_integral) { | 1072 | 192 | block.get_by_position(result).column = | 1073 | 192 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 192 | } else { | 1075 | 36 | block.get_by_position(result).column = std::move(col_to); | 1076 | 36 | } | 1077 | 228 | return Status::OK(); | 1078 | 228 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 36 | using FromFieldType = typename FromDataType::FieldType; | 983 | 36 | using ToFieldType = typename ToDataType::FieldType; | 984 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 36 | const auto* col_from = | 986 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 36 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 36 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 36 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 36 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 36 | ToDataType::check_type_precision(to_precision); | 1000 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 36 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 36 | bool narrow_integral = | 1006 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 36 | size_t size = col_from->size(); | 1012 | 36 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 36 | NullMap::value_type* null_map_data = nullptr; | 1014 | 36 | if (narrow_integral) { | 1015 | 36 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 36 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 36 | } | 1018 | 36 | CastParameters params; | 1019 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 36 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 36 | const auto& vec_from = col_from->get_data(); | 1022 | 36 | const auto* vec_from_data = vec_from.data(); | 1023 | 36 | auto& vec_to = col_to->get_data(); | 1024 | 36 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 36 | using MaxFieldType = | 1027 | 36 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 36 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 36 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 36 | Decimal128V3, | 1031 | 36 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 36 | FromFieldType, ToFieldType>>; | 1033 | 36 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 36 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 36 | bool multiply_may_overflow = false; | 1037 | 36 | if (to_scale > from_scale) { | 1038 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 36 | } | 1040 | | | 1041 | 36 | typename ToFieldType::NativeType max_result = | 1042 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 36 | MaxNativeType multiplier {}; | 1046 | 36 | if (from_scale < to_scale) { | 1047 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 36 | from_scale); | 1049 | 36 | } else if (from_scale > to_scale) { | 1050 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 0 | to_scale); | 1052 | 0 | } | 1053 | 36 | RETURN_IF_ERROR(std::visit( | 1054 | 36 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 36 | for (size_t i = 0; i < size; i++) { | 1056 | 36 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 36 | multiply_may_overflow, narrow_integral>( | 1058 | 36 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 36 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 36 | params)) { | 1061 | 36 | if (set_nullable) { | 1062 | 36 | null_map_data[i] = 1; | 1063 | 36 | } else { | 1064 | 36 | return params.status; | 1065 | 36 | } | 1066 | 36 | } | 1067 | 36 | } | 1068 | 36 | return Status::OK(); | 1069 | 36 | }, | 1070 | 36 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 132 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 132 | using FromFieldType = typename FromDataType::FieldType; | 983 | 132 | using ToFieldType = typename ToDataType::FieldType; | 984 | 132 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 132 | const auto* col_from = | 986 | 132 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 132 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 132 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 132 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 132 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 132 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 132 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 132 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 132 | ToDataType::check_type_precision(to_precision); | 1000 | 132 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 132 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 132 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 132 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 132 | bool narrow_integral = | 1006 | 132 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 132 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 132 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 132 | size_t size = col_from->size(); | 1012 | 132 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 132 | NullMap::value_type* null_map_data = nullptr; | 1014 | 132 | if (narrow_integral) { | 1015 | 32 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 32 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 32 | } | 1018 | 132 | CastParameters params; | 1019 | 132 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 132 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 132 | const auto& vec_from = col_from->get_data(); | 1022 | 132 | const auto* vec_from_data = vec_from.data(); | 1023 | 132 | auto& vec_to = col_to->get_data(); | 1024 | 132 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 132 | using MaxFieldType = | 1027 | 132 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 132 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 132 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 132 | Decimal128V3, | 1031 | 132 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 132 | FromFieldType, ToFieldType>>; | 1033 | 132 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 132 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 132 | bool multiply_may_overflow = false; | 1037 | 132 | if (to_scale > from_scale) { | 1038 | 70 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 70 | } | 1040 | | | 1041 | 132 | typename ToFieldType::NativeType max_result = | 1042 | 132 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 132 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 132 | MaxNativeType multiplier {}; | 1046 | 132 | if (from_scale < to_scale) { | 1047 | 70 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 70 | from_scale); | 1049 | 70 | } else if (from_scale > to_scale) { | 1050 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 30 | to_scale); | 1052 | 30 | } | 1053 | 132 | RETURN_IF_ERROR(std::visit( | 1054 | 132 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 132 | for (size_t i = 0; i < size; i++) { | 1056 | 132 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 132 | multiply_may_overflow, narrow_integral>( | 1058 | 132 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 132 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 132 | params)) { | 1061 | 132 | if (set_nullable) { | 1062 | 132 | null_map_data[i] = 1; | 1063 | 132 | } else { | 1064 | 132 | return params.status; | 1065 | 132 | } | 1066 | 132 | } | 1067 | 132 | } | 1068 | 132 | return Status::OK(); | 1069 | 132 | }, | 1070 | 132 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 132 | if (narrow_integral) { | 1072 | 32 | block.get_by_position(result).column = | 1073 | 32 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 100 | } else { | 1075 | 100 | block.get_by_position(result).column = std::move(col_to); | 1076 | 100 | } | 1077 | 132 | return Status::OK(); | 1078 | 132 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 60 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 60 | using FromFieldType = typename FromDataType::FieldType; | 983 | 60 | using ToFieldType = typename ToDataType::FieldType; | 984 | 60 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 60 | const auto* col_from = | 986 | 60 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 60 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 60 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 60 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 60 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 60 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 60 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 60 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 60 | ToDataType::check_type_precision(to_precision); | 1000 | 60 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 60 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 60 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 60 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 60 | bool narrow_integral = | 1006 | 60 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 60 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 60 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 60 | size_t size = col_from->size(); | 1012 | 60 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 60 | NullMap::value_type* null_map_data = nullptr; | 1014 | 60 | if (narrow_integral) { | 1015 | 60 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 60 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 60 | } | 1018 | 60 | CastParameters params; | 1019 | 60 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 60 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 60 | const auto& vec_from = col_from->get_data(); | 1022 | 60 | const auto* vec_from_data = vec_from.data(); | 1023 | 60 | auto& vec_to = col_to->get_data(); | 1024 | 60 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 60 | using MaxFieldType = | 1027 | 60 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 60 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 60 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 60 | Decimal128V3, | 1031 | 60 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 60 | FromFieldType, ToFieldType>>; | 1033 | 60 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 60 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 60 | bool multiply_may_overflow = false; | 1037 | 60 | if (to_scale > from_scale) { | 1038 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 60 | } | 1040 | | | 1041 | 60 | typename ToFieldType::NativeType max_result = | 1042 | 60 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 60 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 60 | MaxNativeType multiplier {}; | 1046 | 60 | if (from_scale < to_scale) { | 1047 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 60 | from_scale); | 1049 | 60 | } else if (from_scale > to_scale) { | 1050 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 0 | to_scale); | 1052 | 0 | } | 1053 | 60 | RETURN_IF_ERROR(std::visit( | 1054 | 60 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 60 | for (size_t i = 0; i < size; i++) { | 1056 | 60 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 60 | multiply_may_overflow, narrow_integral>( | 1058 | 60 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 60 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 60 | params)) { | 1061 | 60 | if (set_nullable) { | 1062 | 60 | null_map_data[i] = 1; | 1063 | 60 | } else { | 1064 | 60 | return params.status; | 1065 | 60 | } | 1066 | 60 | } | 1067 | 60 | } | 1068 | 60 | return Status::OK(); | 1069 | 60 | }, | 1070 | 60 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 60 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 204 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 204 | using FromFieldType = typename FromDataType::FieldType; | 983 | 204 | using ToFieldType = typename ToDataType::FieldType; | 984 | 204 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 204 | const auto* col_from = | 986 | 204 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 204 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 204 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 204 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 204 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 204 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 204 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 204 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 204 | ToDataType::check_type_precision(to_precision); | 1000 | 204 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 204 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 204 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 204 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 204 | bool narrow_integral = | 1006 | 204 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 204 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 204 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 204 | size_t size = col_from->size(); | 1012 | 204 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 204 | NullMap::value_type* null_map_data = nullptr; | 1014 | 204 | if (narrow_integral) { | 1015 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 56 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 56 | } | 1018 | 204 | CastParameters params; | 1019 | 204 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 204 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 204 | const auto& vec_from = col_from->get_data(); | 1022 | 204 | const auto* vec_from_data = vec_from.data(); | 1023 | 204 | auto& vec_to = col_to->get_data(); | 1024 | 204 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 204 | using MaxFieldType = | 1027 | 204 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 204 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 204 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 204 | Decimal128V3, | 1031 | 204 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 204 | FromFieldType, ToFieldType>>; | 1033 | 204 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 204 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 204 | bool multiply_may_overflow = false; | 1037 | 204 | if (to_scale > from_scale) { | 1038 | 100 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 100 | } | 1040 | | | 1041 | 204 | typename ToFieldType::NativeType max_result = | 1042 | 204 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 204 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 204 | MaxNativeType multiplier {}; | 1046 | 204 | if (from_scale < to_scale) { | 1047 | 100 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 100 | from_scale); | 1049 | 104 | } else if (from_scale > to_scale) { | 1050 | 56 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 56 | to_scale); | 1052 | 56 | } | 1053 | 204 | RETURN_IF_ERROR(std::visit( | 1054 | 204 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 204 | for (size_t i = 0; i < size; i++) { | 1056 | 204 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 204 | multiply_may_overflow, narrow_integral>( | 1058 | 204 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 204 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 204 | params)) { | 1061 | 204 | if (set_nullable) { | 1062 | 204 | null_map_data[i] = 1; | 1063 | 204 | } else { | 1064 | 204 | return params.status; | 1065 | 204 | } | 1066 | 204 | } | 1067 | 204 | } | 1068 | 204 | return Status::OK(); | 1069 | 204 | }, | 1070 | 204 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 204 | if (narrow_integral) { | 1072 | 56 | block.get_by_position(result).column = | 1073 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 148 | } else { | 1075 | 148 | block.get_by_position(result).column = std::move(col_to); | 1076 | 148 | } | 1077 | 204 | return Status::OK(); | 1078 | 204 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 60 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 60 | using FromFieldType = typename FromDataType::FieldType; | 983 | 60 | using ToFieldType = typename ToDataType::FieldType; | 984 | 60 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 60 | const auto* col_from = | 986 | 60 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 60 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 60 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 60 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 60 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 60 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 60 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 60 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 60 | ToDataType::check_type_precision(to_precision); | 1000 | 60 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 60 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 60 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 60 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 60 | bool narrow_integral = | 1006 | 60 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 60 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 60 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 60 | size_t size = col_from->size(); | 1012 | 60 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 60 | NullMap::value_type* null_map_data = nullptr; | 1014 | 60 | if (narrow_integral) { | 1015 | 60 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 60 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 60 | } | 1018 | 60 | CastParameters params; | 1019 | 60 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 60 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 60 | const auto& vec_from = col_from->get_data(); | 1022 | 60 | const auto* vec_from_data = vec_from.data(); | 1023 | 60 | auto& vec_to = col_to->get_data(); | 1024 | 60 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 60 | using MaxFieldType = | 1027 | 60 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 60 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 60 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 60 | Decimal128V3, | 1031 | 60 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 60 | FromFieldType, ToFieldType>>; | 1033 | 60 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 60 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 60 | bool multiply_may_overflow = false; | 1037 | 60 | if (to_scale > from_scale) { | 1038 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 60 | } | 1040 | | | 1041 | 60 | typename ToFieldType::NativeType max_result = | 1042 | 60 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 60 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 60 | MaxNativeType multiplier {}; | 1046 | 60 | if (from_scale < to_scale) { | 1047 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 60 | from_scale); | 1049 | 60 | } else if (from_scale > to_scale) { | 1050 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 0 | to_scale); | 1052 | 0 | } | 1053 | 60 | RETURN_IF_ERROR(std::visit( | 1054 | 60 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 60 | for (size_t i = 0; i < size; i++) { | 1056 | 60 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 60 | multiply_may_overflow, narrow_integral>( | 1058 | 60 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 60 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 60 | params)) { | 1061 | 60 | if (set_nullable) { | 1062 | 60 | null_map_data[i] = 1; | 1063 | 60 | } else { | 1064 | 60 | return params.status; | 1065 | 60 | } | 1066 | 60 | } | 1067 | 60 | } | 1068 | 60 | return Status::OK(); | 1069 | 60 | }, | 1070 | 60 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 60 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 204 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 204 | using FromFieldType = typename FromDataType::FieldType; | 983 | 204 | using ToFieldType = typename ToDataType::FieldType; | 984 | 204 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 204 | const auto* col_from = | 986 | 204 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 204 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 204 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 204 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 204 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 204 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 204 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 204 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 204 | ToDataType::check_type_precision(to_precision); | 1000 | 204 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 204 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 204 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 204 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 204 | bool narrow_integral = | 1006 | 204 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 204 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 204 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 204 | size_t size = col_from->size(); | 1012 | 204 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 204 | NullMap::value_type* null_map_data = nullptr; | 1014 | 204 | if (narrow_integral) { | 1015 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 56 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 56 | } | 1018 | 204 | CastParameters params; | 1019 | 204 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 204 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 204 | const auto& vec_from = col_from->get_data(); | 1022 | 204 | const auto* vec_from_data = vec_from.data(); | 1023 | 204 | auto& vec_to = col_to->get_data(); | 1024 | 204 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 204 | using MaxFieldType = | 1027 | 204 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 204 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 204 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 204 | Decimal128V3, | 1031 | 204 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 204 | FromFieldType, ToFieldType>>; | 1033 | 204 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 204 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 204 | bool multiply_may_overflow = false; | 1037 | 204 | if (to_scale > from_scale) { | 1038 | 99 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 99 | } | 1040 | | | 1041 | 204 | typename ToFieldType::NativeType max_result = | 1042 | 204 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 204 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 204 | MaxNativeType multiplier {}; | 1046 | 204 | if (from_scale < to_scale) { | 1047 | 99 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 99 | from_scale); | 1049 | 105 | } else if (from_scale > to_scale) { | 1050 | 56 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 56 | to_scale); | 1052 | 56 | } | 1053 | 204 | RETURN_IF_ERROR(std::visit( | 1054 | 204 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 204 | for (size_t i = 0; i < size; i++) { | 1056 | 204 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 204 | multiply_may_overflow, narrow_integral>( | 1058 | 204 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 204 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 204 | params)) { | 1061 | 204 | if (set_nullable) { | 1062 | 204 | null_map_data[i] = 1; | 1063 | 204 | } else { | 1064 | 204 | return params.status; | 1065 | 204 | } | 1066 | 204 | } | 1067 | 204 | } | 1068 | 204 | return Status::OK(); | 1069 | 204 | }, | 1070 | 204 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 204 | if (narrow_integral) { | 1072 | 56 | block.get_by_position(result).column = | 1073 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 148 | } else { | 1075 | 148 | block.get_by_position(result).column = std::move(col_to); | 1076 | 148 | } | 1077 | 204 | return Status::OK(); | 1078 | 204 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 92 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 92 | using FromFieldType = typename FromDataType::FieldType; | 983 | 92 | using ToFieldType = typename ToDataType::FieldType; | 984 | 92 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 92 | const auto* col_from = | 986 | 92 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 92 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 92 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 92 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 92 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 92 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 92 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 92 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 92 | ToDataType::check_type_precision(to_precision); | 1000 | 92 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 92 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 92 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 92 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 92 | bool narrow_integral = | 1006 | 92 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 92 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 92 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 92 | size_t size = col_from->size(); | 1012 | 92 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 92 | NullMap::value_type* null_map_data = nullptr; | 1014 | 92 | if (narrow_integral) { | 1015 | 92 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 92 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 92 | } | 1018 | 92 | CastParameters params; | 1019 | 92 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 92 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 92 | const auto& vec_from = col_from->get_data(); | 1022 | 92 | const auto* vec_from_data = vec_from.data(); | 1023 | 92 | auto& vec_to = col_to->get_data(); | 1024 | 92 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 92 | using MaxFieldType = | 1027 | 92 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 92 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 92 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 92 | Decimal128V3, | 1031 | 92 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 92 | FromFieldType, ToFieldType>>; | 1033 | 92 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 92 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 92 | bool multiply_may_overflow = false; | 1037 | 92 | if (to_scale > from_scale) { | 1038 | 66 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 66 | } | 1040 | | | 1041 | 92 | typename ToFieldType::NativeType max_result = | 1042 | 92 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 92 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 92 | MaxNativeType multiplier {}; | 1046 | 92 | if (from_scale < to_scale) { | 1047 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 66 | from_scale); | 1049 | 66 | } else if (from_scale > to_scale) { | 1050 | 20 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 20 | to_scale); | 1052 | 20 | } | 1053 | 92 | RETURN_IF_ERROR(std::visit( | 1054 | 92 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 92 | for (size_t i = 0; i < size; i++) { | 1056 | 92 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 92 | multiply_may_overflow, narrow_integral>( | 1058 | 92 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 92 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 92 | params)) { | 1061 | 92 | if (set_nullable) { | 1062 | 92 | null_map_data[i] = 1; | 1063 | 92 | } else { | 1064 | 92 | return params.status; | 1065 | 92 | } | 1066 | 92 | } | 1067 | 92 | } | 1068 | 92 | return Status::OK(); | 1069 | 92 | }, | 1070 | 92 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 0 | if (narrow_integral) { | 1072 | 0 | block.get_by_position(result).column = | 1073 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 0 | } else { | 1075 | 0 | block.get_by_position(result).column = std::move(col_to); | 1076 | 0 | } | 1077 | 0 | return Status::OK(); | 1078 | 92 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 981 | 180 | const NullMap::value_type* null_map = nullptr) const override { | 982 | 180 | using FromFieldType = typename FromDataType::FieldType; | 983 | 180 | using ToFieldType = typename ToDataType::FieldType; | 984 | 180 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 985 | 180 | const auto* col_from = | 986 | 180 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 987 | 180 | if (!col_from) { | 988 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 989 | 0 | named_from.column->get_name()); | 990 | 0 | } | 991 | | | 992 | 180 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 993 | 180 | UInt32 from_precision = from_decimal_type.get_precision(); | 994 | 180 | UInt32 from_scale = from_decimal_type.get_scale(); | 995 | | | 996 | 180 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 997 | 180 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 998 | 180 | UInt32 to_precision = to_decimal_type.get_precision(); | 999 | 180 | ToDataType::check_type_precision(to_precision); | 1000 | 180 | UInt32 to_scale = to_decimal_type.get_scale(); | 1001 | 180 | ToDataType::check_type_scale(to_scale); | 1002 | | | 1003 | 180 | auto from_max_int_digit_count = from_precision - from_scale; | 1004 | 180 | auto to_max_int_digit_count = to_precision - to_scale; | 1005 | 180 | bool narrow_integral = | 1006 | 180 | (to_max_int_digit_count < from_max_int_digit_count) || | 1007 | 180 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1008 | | // only in non-strict mode and may overflow, we set nullable | 1009 | 180 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1010 | | | 1011 | 180 | size_t size = col_from->size(); | 1012 | 180 | ColumnUInt8::MutablePtr col_null_map_to; | 1013 | 180 | NullMap::value_type* null_map_data = nullptr; | 1014 | 180 | if (narrow_integral) { | 1015 | 104 | col_null_map_to = ColumnUInt8::create(size, 0); | 1016 | 104 | null_map_data = col_null_map_to->get_data().data(); | 1017 | 104 | } | 1018 | 180 | CastParameters params; | 1019 | 180 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1020 | 180 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1021 | 180 | const auto& vec_from = col_from->get_data(); | 1022 | 180 | const auto* vec_from_data = vec_from.data(); | 1023 | 180 | auto& vec_to = col_to->get_data(); | 1024 | 180 | auto* vec_to_data = vec_to.data(); | 1025 | | | 1026 | 180 | using MaxFieldType = | 1027 | 180 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1028 | 180 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1029 | 180 | std::is_same_v<FromFieldType, Decimal128V3>), | 1030 | 180 | Decimal128V3, | 1031 | 180 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1032 | 180 | FromFieldType, ToFieldType>>; | 1033 | 180 | using MaxNativeType = typename MaxFieldType::NativeType; | 1034 | | | 1035 | 180 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1036 | 180 | bool multiply_may_overflow = false; | 1037 | 180 | if (to_scale > from_scale) { | 1038 | 86 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1039 | 86 | } | 1040 | | | 1041 | 180 | typename ToFieldType::NativeType max_result = | 1042 | 180 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1043 | 180 | typename ToFieldType::NativeType min_result = -max_result; | 1044 | | | 1045 | 180 | MaxNativeType multiplier {}; | 1046 | 180 | if (from_scale < to_scale) { | 1047 | 86 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1048 | 86 | from_scale); | 1049 | 94 | } else if (from_scale > to_scale) { | 1050 | 68 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1051 | 68 | to_scale); | 1052 | 68 | } | 1053 | 180 | RETURN_IF_ERROR(std::visit( | 1054 | 180 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1055 | 180 | for (size_t i = 0; i < size; i++) { | 1056 | 180 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1057 | 180 | multiply_may_overflow, narrow_integral>( | 1058 | 180 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1059 | 180 | to_precision, to_scale, min_result, max_result, multiplier, | 1060 | 180 | params)) { | 1061 | 180 | if (set_nullable) { | 1062 | 180 | null_map_data[i] = 1; | 1063 | 180 | } else { | 1064 | 180 | return params.status; | 1065 | 180 | } | 1066 | 180 | } | 1067 | 180 | } | 1068 | 180 | return Status::OK(); | 1069 | 180 | }, | 1070 | 180 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1071 | 180 | if (narrow_integral) { | 1072 | 104 | block.get_by_position(result).column = | 1073 | 104 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1074 | 104 | } else { | 1075 | 76 | block.get_by_position(result).column = std::move(col_to); | 1076 | 76 | } | 1077 | 180 | return Status::OK(); | 1078 | 180 | } |
|
1079 | | }; |
1080 | | |
1081 | | template <typename T> |
1082 | | constexpr static bool type_allow_cast_to_decimal = |
1083 | | std::is_same_v<T, DataTypeString> || IsDataTypeNumber<T> || IsDataTypeDecimal<T>; |
1084 | | |
1085 | | namespace CastWrapper { |
1086 | | |
1087 | | template <typename ToDataType> |
1088 | 12.3k | WrapperType create_decimal_wrapper(FunctionContext* context, const DataTypePtr& from_type) { |
1089 | 12.3k | std::shared_ptr<CastToBase> cast_impl; |
1090 | | |
1091 | 12.3k | auto make_cast_wrapper = [&](const auto& types) -> bool { |
1092 | 12.3k | using Types = std::decay_t<decltype(types)>; |
1093 | 12.3k | using FromDataType = typename Types::LeftType; |
1094 | 12.3k | if constexpr (type_allow_cast_to_decimal<FromDataType>) { |
1095 | 12.3k | if (context->enable_strict_mode()) { |
1096 | 5.35k | cast_impl = std::make_shared< |
1097 | 5.35k | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); |
1098 | 6.95k | } else { |
1099 | 6.95k | cast_impl = std::make_shared< |
1100 | 6.95k | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); |
1101 | 6.95k | } |
1102 | 12.3k | return true; |
1103 | 12.3k | } else { |
1104 | 0 | return false; |
1105 | 0 | } |
1106 | 12.3k | }; _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_2EEEvEEEEbSS_ Line | Count | Source | 1091 | 4 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 4 | using Types = std::decay_t<decltype(types)>; | 1093 | 4 | using FromDataType = typename Types::LeftType; | 1094 | 4 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 4 | if (context->enable_strict_mode()) { | 1096 | 2 | cast_impl = std::make_shared< | 1097 | 2 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 2 | } else { | 1099 | 2 | cast_impl = std::make_shared< | 1100 | 2 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 2 | } | 1102 | 4 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 4 | }; |
Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_3EEEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_4EEEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_5EEEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_6EEEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_7EEEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_8EEEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_9EEEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_28EEEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_29EEEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_30EEEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_35EEEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_ _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_2EEEvEEEEbSS_ Line | Count | Source | 1091 | 7 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 7 | using Types = std::decay_t<decltype(types)>; | 1093 | 7 | using FromDataType = typename Types::LeftType; | 1094 | 7 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 7 | if (context->enable_strict_mode()) { | 1096 | 2 | cast_impl = std::make_shared< | 1097 | 2 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 5 | } else { | 1099 | 5 | cast_impl = std::make_shared< | 1100 | 5 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 5 | } | 1102 | 7 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 7 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_3EEEvEEEEbSS_ Line | Count | Source | 1091 | 34 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 34 | using Types = std::decay_t<decltype(types)>; | 1093 | 34 | using FromDataType = typename Types::LeftType; | 1094 | 34 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 34 | if (context->enable_strict_mode()) { | 1096 | 23 | cast_impl = std::make_shared< | 1097 | 23 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 23 | } else { | 1099 | 11 | cast_impl = std::make_shared< | 1100 | 11 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 11 | } | 1102 | 34 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 34 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_4EEEvEEEEbSS_ Line | Count | Source | 1091 | 39 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 39 | using Types = std::decay_t<decltype(types)>; | 1093 | 39 | using FromDataType = typename Types::LeftType; | 1094 | 39 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 39 | if (context->enable_strict_mode()) { | 1096 | 27 | cast_impl = std::make_shared< | 1097 | 27 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 27 | } else { | 1099 | 12 | cast_impl = std::make_shared< | 1100 | 12 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 12 | } | 1102 | 39 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 39 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_5EEEvEEEEbSS_ Line | Count | Source | 1091 | 49 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 49 | using Types = std::decay_t<decltype(types)>; | 1093 | 49 | using FromDataType = typename Types::LeftType; | 1094 | 49 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 49 | if (context->enable_strict_mode()) { | 1096 | 35 | cast_impl = std::make_shared< | 1097 | 35 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 35 | } else { | 1099 | 14 | cast_impl = std::make_shared< | 1100 | 14 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 14 | } | 1102 | 49 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 49 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_6EEEvEEEEbSS_ Line | Count | Source | 1091 | 49 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 49 | using Types = std::decay_t<decltype(types)>; | 1093 | 49 | using FromDataType = typename Types::LeftType; | 1094 | 49 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 49 | if (context->enable_strict_mode()) { | 1096 | 35 | cast_impl = std::make_shared< | 1097 | 35 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 35 | } else { | 1099 | 14 | cast_impl = std::make_shared< | 1100 | 14 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 14 | } | 1102 | 49 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 49 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_7EEEvEEEEbSS_ Line | Count | Source | 1091 | 49 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 49 | using Types = std::decay_t<decltype(types)>; | 1093 | 49 | using FromDataType = typename Types::LeftType; | 1094 | 49 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 49 | if (context->enable_strict_mode()) { | 1096 | 35 | cast_impl = std::make_shared< | 1097 | 35 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 35 | } else { | 1099 | 14 | cast_impl = std::make_shared< | 1100 | 14 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 14 | } | 1102 | 49 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 49 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_8EEEvEEEEbSS_ Line | Count | Source | 1091 | 99 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 99 | using Types = std::decay_t<decltype(types)>; | 1093 | 99 | using FromDataType = typename Types::LeftType; | 1094 | 99 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 99 | if (context->enable_strict_mode()) { | 1096 | 18 | cast_impl = std::make_shared< | 1097 | 18 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 81 | } else { | 1099 | 81 | cast_impl = std::make_shared< | 1100 | 81 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 81 | } | 1102 | 99 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 99 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_9EEEvEEEEbSS_ Line | Count | Source | 1091 | 103 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 103 | using Types = std::decay_t<decltype(types)>; | 1093 | 103 | using FromDataType = typename Types::LeftType; | 1094 | 103 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 103 | if (context->enable_strict_mode()) { | 1096 | 18 | cast_impl = std::make_shared< | 1097 | 18 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 85 | } else { | 1099 | 85 | cast_impl = std::make_shared< | 1100 | 85 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 85 | } | 1102 | 103 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 103 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_ Line | Count | Source | 1091 | 128 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 128 | using Types = std::decay_t<decltype(types)>; | 1093 | 128 | using FromDataType = typename Types::LeftType; | 1094 | 128 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 128 | if (context->enable_strict_mode()) { | 1096 | 53 | cast_impl = std::make_shared< | 1097 | 53 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 75 | } else { | 1099 | 75 | cast_impl = std::make_shared< | 1100 | 75 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 75 | } | 1102 | 128 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 128 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_29EEEvEEEEbSS_ Line | Count | Source | 1091 | 285 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 285 | using Types = std::decay_t<decltype(types)>; | 1093 | 285 | using FromDataType = typename Types::LeftType; | 1094 | 285 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 285 | if (context->enable_strict_mode()) { | 1096 | 129 | cast_impl = std::make_shared< | 1097 | 129 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 156 | } else { | 1099 | 156 | cast_impl = std::make_shared< | 1100 | 156 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 156 | } | 1102 | 285 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 285 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_20EEEvEEEEbSS_ Line | Count | Source | 1091 | 161 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 161 | using Types = std::decay_t<decltype(types)>; | 1093 | 161 | using FromDataType = typename Types::LeftType; | 1094 | 161 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 161 | if (context->enable_strict_mode()) { | 1096 | 87 | cast_impl = std::make_shared< | 1097 | 87 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 87 | } else { | 1099 | 74 | cast_impl = std::make_shared< | 1100 | 74 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 74 | } | 1102 | 161 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 161 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_30EEEvEEEEbSS_ Line | Count | Source | 1091 | 296 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 296 | using Types = std::decay_t<decltype(types)>; | 1093 | 296 | using FromDataType = typename Types::LeftType; | 1094 | 296 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 296 | if (context->enable_strict_mode()) { | 1096 | 140 | cast_impl = std::make_shared< | 1097 | 140 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 156 | } else { | 1099 | 156 | cast_impl = std::make_shared< | 1100 | 156 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 156 | } | 1102 | 296 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 296 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_35EEEvEEEEbSS_ Line | Count | Source | 1091 | 296 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 296 | using Types = std::decay_t<decltype(types)>; | 1093 | 296 | using FromDataType = typename Types::LeftType; | 1094 | 296 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 296 | if (context->enable_strict_mode()) { | 1096 | 140 | cast_impl = std::make_shared< | 1097 | 140 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 156 | } else { | 1099 | 156 | cast_impl = std::make_shared< | 1100 | 156 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 156 | } | 1102 | 296 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 296 | }; |
Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_ _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_ Line | Count | Source | 1091 | 1.63k | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 1.63k | using Types = std::decay_t<decltype(types)>; | 1093 | 1.63k | using FromDataType = typename Types::LeftType; | 1094 | 1.63k | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 1.63k | if (context->enable_strict_mode()) { | 1096 | 854 | cast_impl = std::make_shared< | 1097 | 854 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 854 | } else { | 1099 | 782 | cast_impl = std::make_shared< | 1100 | 782 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 782 | } | 1102 | 1.63k | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 1.63k | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_2EEEvEEEEbSS_ Line | Count | Source | 1091 | 7 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 7 | using Types = std::decay_t<decltype(types)>; | 1093 | 7 | using FromDataType = typename Types::LeftType; | 1094 | 7 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 7 | if (context->enable_strict_mode()) { | 1096 | 2 | cast_impl = std::make_shared< | 1097 | 2 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 5 | } else { | 1099 | 5 | cast_impl = std::make_shared< | 1100 | 5 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 5 | } | 1102 | 7 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 7 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_3EEEvEEEEbSS_ Line | Count | Source | 1091 | 29 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 29 | using Types = std::decay_t<decltype(types)>; | 1093 | 29 | using FromDataType = typename Types::LeftType; | 1094 | 29 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 29 | if (context->enable_strict_mode()) { | 1096 | 19 | cast_impl = std::make_shared< | 1097 | 19 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 19 | } else { | 1099 | 10 | cast_impl = std::make_shared< | 1100 | 10 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 10 | } | 1102 | 29 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 29 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_4EEEvEEEEbSS_ Line | Count | Source | 1091 | 29 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 29 | using Types = std::decay_t<decltype(types)>; | 1093 | 29 | using FromDataType = typename Types::LeftType; | 1094 | 29 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 29 | if (context->enable_strict_mode()) { | 1096 | 19 | cast_impl = std::make_shared< | 1097 | 19 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 19 | } else { | 1099 | 10 | cast_impl = std::make_shared< | 1100 | 10 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 10 | } | 1102 | 29 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 29 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_5EEEvEEEEbSS_ Line | Count | Source | 1091 | 44 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 44 | using Types = std::decay_t<decltype(types)>; | 1093 | 44 | using FromDataType = typename Types::LeftType; | 1094 | 44 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 44 | if (context->enable_strict_mode()) { | 1096 | 31 | cast_impl = std::make_shared< | 1097 | 31 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 31 | } else { | 1099 | 13 | cast_impl = std::make_shared< | 1100 | 13 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 13 | } | 1102 | 44 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 44 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_6EEEvEEEEbSS_ Line | Count | Source | 1091 | 49 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 49 | using Types = std::decay_t<decltype(types)>; | 1093 | 49 | using FromDataType = typename Types::LeftType; | 1094 | 49 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 49 | if (context->enable_strict_mode()) { | 1096 | 35 | cast_impl = std::make_shared< | 1097 | 35 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 35 | } else { | 1099 | 14 | cast_impl = std::make_shared< | 1100 | 14 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 14 | } | 1102 | 49 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 49 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_7EEEvEEEEbSS_ Line | Count | Source | 1091 | 49 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 49 | using Types = std::decay_t<decltype(types)>; | 1093 | 49 | using FromDataType = typename Types::LeftType; | 1094 | 49 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 49 | if (context->enable_strict_mode()) { | 1096 | 35 | cast_impl = std::make_shared< | 1097 | 35 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 35 | } else { | 1099 | 14 | cast_impl = std::make_shared< | 1100 | 14 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 14 | } | 1102 | 49 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 49 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_8EEEvEEEEbSS_ Line | Count | Source | 1091 | 99 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 99 | using Types = std::decay_t<decltype(types)>; | 1093 | 99 | using FromDataType = typename Types::LeftType; | 1094 | 99 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 99 | if (context->enable_strict_mode()) { | 1096 | 18 | cast_impl = std::make_shared< | 1097 | 18 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 81 | } else { | 1099 | 81 | cast_impl = std::make_shared< | 1100 | 81 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 81 | } | 1102 | 99 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 99 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_9EEEvEEEEbSS_ Line | Count | Source | 1091 | 99 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 99 | using Types = std::decay_t<decltype(types)>; | 1093 | 99 | using FromDataType = typename Types::LeftType; | 1094 | 99 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 99 | if (context->enable_strict_mode()) { | 1096 | 18 | cast_impl = std::make_shared< | 1097 | 18 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 81 | } else { | 1099 | 81 | cast_impl = std::make_shared< | 1100 | 81 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 81 | } | 1102 | 99 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 99 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_28EEEvEEEEbSS_ Line | Count | Source | 1091 | 168 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 168 | using Types = std::decay_t<decltype(types)>; | 1093 | 168 | using FromDataType = typename Types::LeftType; | 1094 | 168 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 168 | if (context->enable_strict_mode()) { | 1096 | 36 | cast_impl = std::make_shared< | 1097 | 36 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 132 | } else { | 1099 | 132 | cast_impl = std::make_shared< | 1100 | 132 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 132 | } | 1102 | 168 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 168 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_ Line | Count | Source | 1091 | 272 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 272 | using Types = std::decay_t<decltype(types)>; | 1093 | 272 | using FromDataType = typename Types::LeftType; | 1094 | 272 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 272 | if (context->enable_strict_mode()) { | 1096 | 92 | cast_impl = std::make_shared< | 1097 | 92 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 180 | } else { | 1099 | 180 | cast_impl = std::make_shared< | 1100 | 180 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 180 | } | 1102 | 272 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 272 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_20EEEvEEEEbSS_ Line | Count | Source | 1091 | 180 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 180 | using Types = std::decay_t<decltype(types)>; | 1093 | 180 | using FromDataType = typename Types::LeftType; | 1094 | 180 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 180 | if (context->enable_strict_mode()) { | 1096 | 72 | cast_impl = std::make_shared< | 1097 | 72 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 108 | } else { | 1099 | 108 | cast_impl = std::make_shared< | 1100 | 108 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 108 | } | 1102 | 180 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 180 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_30EEEvEEEEbSS_ Line | Count | Source | 1091 | 381 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 381 | using Types = std::decay_t<decltype(types)>; | 1093 | 381 | using FromDataType = typename Types::LeftType; | 1094 | 381 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 381 | if (context->enable_strict_mode()) { | 1096 | 153 | cast_impl = std::make_shared< | 1097 | 153 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 228 | } else { | 1099 | 228 | cast_impl = std::make_shared< | 1100 | 228 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 228 | } | 1102 | 381 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 381 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_35EEEvEEEEbSS_ Line | Count | Source | 1091 | 392 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 392 | using Types = std::decay_t<decltype(types)>; | 1093 | 392 | using FromDataType = typename Types::LeftType; | 1094 | 392 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 392 | if (context->enable_strict_mode()) { | 1096 | 164 | cast_impl = std::make_shared< | 1097 | 164 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 228 | } else { | 1099 | 228 | cast_impl = std::make_shared< | 1100 | 228 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 228 | } | 1102 | 392 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 392 | }; |
Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_ _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_ Line | Count | Source | 1091 | 1.41k | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 1.41k | using Types = std::decay_t<decltype(types)>; | 1093 | 1.41k | using FromDataType = typename Types::LeftType; | 1094 | 1.41k | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 1.41k | if (context->enable_strict_mode()) { | 1096 | 709 | cast_impl = std::make_shared< | 1097 | 709 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 709 | } else { | 1099 | 709 | cast_impl = std::make_shared< | 1100 | 709 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 709 | } | 1102 | 1.41k | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 1.41k | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_2EEEvEEEEbSS_ Line | Count | Source | 1091 | 7 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 7 | using Types = std::decay_t<decltype(types)>; | 1093 | 7 | using FromDataType = typename Types::LeftType; | 1094 | 7 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 7 | if (context->enable_strict_mode()) { | 1096 | 2 | cast_impl = std::make_shared< | 1097 | 2 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 5 | } else { | 1099 | 5 | cast_impl = std::make_shared< | 1100 | 5 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 5 | } | 1102 | 7 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 7 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_3EEEvEEEEbSS_ Line | Count | Source | 1091 | 29 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 29 | using Types = std::decay_t<decltype(types)>; | 1093 | 29 | using FromDataType = typename Types::LeftType; | 1094 | 29 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 29 | if (context->enable_strict_mode()) { | 1096 | 19 | cast_impl = std::make_shared< | 1097 | 19 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 19 | } else { | 1099 | 10 | cast_impl = std::make_shared< | 1100 | 10 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 10 | } | 1102 | 29 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 29 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_4EEEvEEEEbSS_ Line | Count | Source | 1091 | 29 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 29 | using Types = std::decay_t<decltype(types)>; | 1093 | 29 | using FromDataType = typename Types::LeftType; | 1094 | 29 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 29 | if (context->enable_strict_mode()) { | 1096 | 19 | cast_impl = std::make_shared< | 1097 | 19 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 19 | } else { | 1099 | 10 | cast_impl = std::make_shared< | 1100 | 10 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 10 | } | 1102 | 29 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 29 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_5EEEvEEEEbSS_ Line | Count | Source | 1091 | 29 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 29 | using Types = std::decay_t<decltype(types)>; | 1093 | 29 | using FromDataType = typename Types::LeftType; | 1094 | 29 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 29 | if (context->enable_strict_mode()) { | 1096 | 19 | cast_impl = std::make_shared< | 1097 | 19 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 19 | } else { | 1099 | 10 | cast_impl = std::make_shared< | 1100 | 10 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 10 | } | 1102 | 29 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 29 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_6EEEvEEEEbSS_ Line | Count | Source | 1091 | 34 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 34 | using Types = std::decay_t<decltype(types)>; | 1093 | 34 | using FromDataType = typename Types::LeftType; | 1094 | 34 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 34 | if (context->enable_strict_mode()) { | 1096 | 23 | cast_impl = std::make_shared< | 1097 | 23 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 23 | } else { | 1099 | 11 | cast_impl = std::make_shared< | 1100 | 11 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 11 | } | 1102 | 34 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 34 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_7EEEvEEEEbSS_ Line | Count | Source | 1091 | 49 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 49 | using Types = std::decay_t<decltype(types)>; | 1093 | 49 | using FromDataType = typename Types::LeftType; | 1094 | 49 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 49 | if (context->enable_strict_mode()) { | 1096 | 35 | cast_impl = std::make_shared< | 1097 | 35 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 35 | } else { | 1099 | 14 | cast_impl = std::make_shared< | 1100 | 14 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 14 | } | 1102 | 49 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 49 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_8EEEvEEEEbSS_ Line | Count | Source | 1091 | 107 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 107 | using Types = std::decay_t<decltype(types)>; | 1093 | 107 | using FromDataType = typename Types::LeftType; | 1094 | 107 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 107 | if (context->enable_strict_mode()) { | 1096 | 18 | cast_impl = std::make_shared< | 1097 | 18 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 89 | } else { | 1099 | 89 | cast_impl = std::make_shared< | 1100 | 89 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 89 | } | 1102 | 107 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 107 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_9EEEvEEEEbSS_ Line | Count | Source | 1091 | 91 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 91 | using Types = std::decay_t<decltype(types)>; | 1093 | 91 | using FromDataType = typename Types::LeftType; | 1094 | 91 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 91 | if (context->enable_strict_mode()) { | 1096 | 18 | cast_impl = std::make_shared< | 1097 | 18 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 73 | } else { | 1099 | 73 | cast_impl = std::make_shared< | 1100 | 73 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 73 | } | 1102 | 91 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 91 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_28EEEvEEEEbSS_ Line | Count | Source | 1091 | 168 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 168 | using Types = std::decay_t<decltype(types)>; | 1093 | 168 | using FromDataType = typename Types::LeftType; | 1094 | 168 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 168 | if (context->enable_strict_mode()) { | 1096 | 36 | cast_impl = std::make_shared< | 1097 | 36 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 132 | } else { | 1099 | 132 | cast_impl = std::make_shared< | 1100 | 132 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 132 | } | 1102 | 168 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 168 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_29EEEvEEEEbSS_ Line | Count | Source | 1091 | 264 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 264 | using Types = std::decay_t<decltype(types)>; | 1093 | 264 | using FromDataType = typename Types::LeftType; | 1094 | 264 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 264 | if (context->enable_strict_mode()) { | 1096 | 60 | cast_impl = std::make_shared< | 1097 | 60 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 204 | } else { | 1099 | 204 | cast_impl = std::make_shared< | 1100 | 204 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 204 | } | 1102 | 264 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 264 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_20EEEvEEEEbSS_ Line | Count | Source | 1091 | 135 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 135 | using Types = std::decay_t<decltype(types)>; | 1093 | 135 | using FromDataType = typename Types::LeftType; | 1094 | 135 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 135 | if (context->enable_strict_mode()) { | 1096 | 32 | cast_impl = std::make_shared< | 1097 | 32 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 103 | } else { | 1099 | 103 | cast_impl = std::make_shared< | 1100 | 103 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 103 | } | 1102 | 135 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 135 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_ Line | Count | Source | 1091 | 272 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 272 | using Types = std::decay_t<decltype(types)>; | 1093 | 272 | using FromDataType = typename Types::LeftType; | 1094 | 272 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 272 | if (context->enable_strict_mode()) { | 1096 | 92 | cast_impl = std::make_shared< | 1097 | 92 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 180 | } else { | 1099 | 180 | cast_impl = std::make_shared< | 1100 | 180 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 180 | } | 1102 | 272 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 272 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_35EEEvEEEEbSS_ Line | Count | Source | 1091 | 381 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 381 | using Types = std::decay_t<decltype(types)>; | 1093 | 381 | using FromDataType = typename Types::LeftType; | 1094 | 381 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 381 | if (context->enable_strict_mode()) { | 1096 | 153 | cast_impl = std::make_shared< | 1097 | 153 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 228 | } else { | 1099 | 228 | cast_impl = std::make_shared< | 1100 | 228 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 228 | } | 1102 | 381 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 381 | }; |
Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_ _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_ Line | Count | Source | 1091 | 1.41k | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 1.41k | using Types = std::decay_t<decltype(types)>; | 1093 | 1.41k | using FromDataType = typename Types::LeftType; | 1094 | 1.41k | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 1.41k | if (context->enable_strict_mode()) { | 1096 | 709 | cast_impl = std::make_shared< | 1097 | 709 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 709 | } else { | 1099 | 709 | cast_impl = std::make_shared< | 1100 | 709 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 709 | } | 1102 | 1.41k | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 1.41k | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_2EEEvEEEEbSS_ Line | Count | Source | 1091 | 7 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 7 | using Types = std::decay_t<decltype(types)>; | 1093 | 7 | using FromDataType = typename Types::LeftType; | 1094 | 7 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 7 | if (context->enable_strict_mode()) { | 1096 | 2 | cast_impl = std::make_shared< | 1097 | 2 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 5 | } else { | 1099 | 5 | cast_impl = std::make_shared< | 1100 | 5 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 5 | } | 1102 | 7 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 7 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_3EEEvEEEEbSS_ Line | Count | Source | 1091 | 29 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 29 | using Types = std::decay_t<decltype(types)>; | 1093 | 29 | using FromDataType = typename Types::LeftType; | 1094 | 29 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 29 | if (context->enable_strict_mode()) { | 1096 | 19 | cast_impl = std::make_shared< | 1097 | 19 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 19 | } else { | 1099 | 10 | cast_impl = std::make_shared< | 1100 | 10 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 10 | } | 1102 | 29 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 29 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_4EEEvEEEEbSS_ Line | Count | Source | 1091 | 29 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 29 | using Types = std::decay_t<decltype(types)>; | 1093 | 29 | using FromDataType = typename Types::LeftType; | 1094 | 29 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 29 | if (context->enable_strict_mode()) { | 1096 | 19 | cast_impl = std::make_shared< | 1097 | 19 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 19 | } else { | 1099 | 10 | cast_impl = std::make_shared< | 1100 | 10 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 10 | } | 1102 | 29 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 29 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_5EEEvEEEEbSS_ Line | Count | Source | 1091 | 29 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 29 | using Types = std::decay_t<decltype(types)>; | 1093 | 29 | using FromDataType = typename Types::LeftType; | 1094 | 29 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 29 | if (context->enable_strict_mode()) { | 1096 | 19 | cast_impl = std::make_shared< | 1097 | 19 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 19 | } else { | 1099 | 10 | cast_impl = std::make_shared< | 1100 | 10 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 10 | } | 1102 | 29 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 29 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_6EEEvEEEEbSS_ Line | Count | Source | 1091 | 29 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 29 | using Types = std::decay_t<decltype(types)>; | 1093 | 29 | using FromDataType = typename Types::LeftType; | 1094 | 29 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 29 | if (context->enable_strict_mode()) { | 1096 | 19 | cast_impl = std::make_shared< | 1097 | 19 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 19 | } else { | 1099 | 10 | cast_impl = std::make_shared< | 1100 | 10 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 10 | } | 1102 | 29 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 29 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_7EEEvEEEEbSS_ Line | Count | Source | 1091 | 44 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 44 | using Types = std::decay_t<decltype(types)>; | 1093 | 44 | using FromDataType = typename Types::LeftType; | 1094 | 44 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 44 | if (context->enable_strict_mode()) { | 1096 | 31 | cast_impl = std::make_shared< | 1097 | 31 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 31 | } else { | 1099 | 13 | cast_impl = std::make_shared< | 1100 | 13 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 13 | } | 1102 | 44 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 44 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_8EEEvEEEEbSS_ Line | Count | Source | 1091 | 87 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 87 | using Types = std::decay_t<decltype(types)>; | 1093 | 87 | using FromDataType = typename Types::LeftType; | 1094 | 87 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 87 | if (context->enable_strict_mode()) { | 1096 | 18 | cast_impl = std::make_shared< | 1097 | 18 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 69 | } else { | 1099 | 69 | cast_impl = std::make_shared< | 1100 | 69 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 69 | } | 1102 | 87 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 87 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeNumberILS3_9EEEvEEEEbSS_ Line | Count | Source | 1091 | 99 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 99 | using Types = std::decay_t<decltype(types)>; | 1093 | 99 | using FromDataType = typename Types::LeftType; | 1094 | 99 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 99 | if (context->enable_strict_mode()) { | 1096 | 18 | cast_impl = std::make_shared< | 1097 | 18 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 81 | } else { | 1099 | 81 | cast_impl = std::make_shared< | 1100 | 81 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 81 | } | 1102 | 99 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 99 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_28EEEvEEEEbSS_ Line | Count | Source | 1091 | 168 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 168 | using Types = std::decay_t<decltype(types)>; | 1093 | 168 | using FromDataType = typename Types::LeftType; | 1094 | 168 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 168 | if (context->enable_strict_mode()) { | 1096 | 36 | cast_impl = std::make_shared< | 1097 | 36 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 132 | } else { | 1099 | 132 | cast_impl = std::make_shared< | 1100 | 132 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 132 | } | 1102 | 168 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 168 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_29EEEvEEEEbSS_ Line | Count | Source | 1091 | 264 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 264 | using Types = std::decay_t<decltype(types)>; | 1093 | 264 | using FromDataType = typename Types::LeftType; | 1094 | 264 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 264 | if (context->enable_strict_mode()) { | 1096 | 60 | cast_impl = std::make_shared< | 1097 | 60 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 204 | } else { | 1099 | 204 | cast_impl = std::make_shared< | 1100 | 204 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 204 | } | 1102 | 264 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 264 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_20EEEvEEEEbSS_ Line | Count | Source | 1091 | 132 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 132 | using Types = std::decay_t<decltype(types)>; | 1093 | 132 | using FromDataType = typename Types::LeftType; | 1094 | 132 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 132 | if (context->enable_strict_mode()) { | 1096 | 30 | cast_impl = std::make_shared< | 1097 | 30 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 102 | } else { | 1099 | 102 | cast_impl = std::make_shared< | 1100 | 102 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 102 | } | 1102 | 132 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 132 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_30EEEvEEEEbSS_ Line | Count | Source | 1091 | 264 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 264 | using Types = std::decay_t<decltype(types)>; | 1093 | 264 | using FromDataType = typename Types::LeftType; | 1094 | 264 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 264 | if (context->enable_strict_mode()) { | 1096 | 60 | cast_impl = std::make_shared< | 1097 | 60 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 204 | } else { | 1099 | 204 | cast_impl = std::make_shared< | 1100 | 204 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 204 | } | 1102 | 264 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 264 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_ Line | Count | Source | 1091 | 272 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 272 | using Types = std::decay_t<decltype(types)>; | 1093 | 272 | using FromDataType = typename Types::LeftType; | 1094 | 272 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 272 | if (context->enable_strict_mode()) { | 1096 | 92 | cast_impl = std::make_shared< | 1097 | 92 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 180 | } else { | 1099 | 180 | cast_impl = std::make_shared< | 1100 | 180 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 180 | } | 1102 | 272 | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 272 | }; |
Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_ Unexecuted instantiation: _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_ _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_ Line | Count | Source | 1091 | 1.39k | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 1.39k | using Types = std::decay_t<decltype(types)>; | 1093 | 1.39k | using FromDataType = typename Types::LeftType; | 1094 | 1.39k | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 1.39k | if (context->enable_strict_mode()) { | 1096 | 695 | cast_impl = std::make_shared< | 1097 | 695 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 695 | } else { | 1099 | 695 | cast_impl = std::make_shared< | 1100 | 695 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 695 | } | 1102 | 1.39k | return true; | 1103 | | } else { | 1104 | | return false; | 1105 | | } | 1106 | 1.39k | }; |
|
1107 | | |
1108 | 12.3k | if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) { |
1109 | 0 | return create_unsupport_wrapper( |
1110 | 0 | fmt::format("CAST AS decimal not supported {}", from_type->get_name())); |
1111 | 0 | } |
1112 | | |
1113 | 12.3k | return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
1114 | 12.3k | uint32_t result, size_t input_rows_count, |
1115 | 12.3k | const NullMap::value_type* null_map = nullptr) { |
1116 | 12.3k | return cast_impl->execute_impl(context, block, arguments, result, input_rows_count, |
1117 | 12.3k | null_map); |
1118 | 12.3k | }; _ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_ Line | Count | Source | 1115 | 4 | const NullMap::value_type* null_map = nullptr) { | 1116 | 4 | return cast_impl->execute_impl(context, block, arguments, result, input_rows_count, | 1117 | 4 | null_map); | 1118 | 4 | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_ Line | Count | Source | 1115 | 3.23k | const NullMap::value_type* null_map = nullptr) { | 1116 | 3.23k | return cast_impl->execute_impl(context, block, arguments, result, input_rows_count, | 1117 | 3.23k | null_map); | 1118 | 3.23k | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_ Line | Count | Source | 1115 | 3.21k | const NullMap::value_type* null_map = nullptr) { | 1116 | 3.21k | return cast_impl->execute_impl(context, block, arguments, result, input_rows_count, | 1117 | 3.21k | null_map); | 1118 | 3.21k | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_ Line | Count | Source | 1115 | 3.01k | const NullMap::value_type* null_map = nullptr) { | 1116 | 3.01k | return cast_impl->execute_impl(context, block, arguments, result, input_rows_count, | 1117 | 3.01k | null_map); | 1118 | 3.01k | }; |
_ZZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_ Line | Count | Source | 1115 | 2.84k | const NullMap::value_type* null_map = nullptr) { | 1116 | 2.84k | return cast_impl->execute_impl(context, block, arguments, result, input_rows_count, | 1117 | 2.84k | null_map); | 1118 | 2.84k | }; |
|
1119 | 12.3k | } _ZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE Line | Count | Source | 1088 | 4 | WrapperType create_decimal_wrapper(FunctionContext* context, const DataTypePtr& from_type) { | 1089 | 4 | std::shared_ptr<CastToBase> cast_impl; | 1090 | | | 1091 | 4 | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 4 | using Types = std::decay_t<decltype(types)>; | 1093 | 4 | using FromDataType = typename Types::LeftType; | 1094 | 4 | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 4 | if (context->enable_strict_mode()) { | 1096 | 4 | cast_impl = std::make_shared< | 1097 | 4 | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 4 | } else { | 1099 | 4 | cast_impl = std::make_shared< | 1100 | 4 | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 4 | } | 1102 | 4 | return true; | 1103 | 4 | } else { | 1104 | 4 | return false; | 1105 | 4 | } | 1106 | 4 | }; | 1107 | | | 1108 | 4 | if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) { | 1109 | 0 | return create_unsupport_wrapper( | 1110 | 0 | fmt::format("CAST AS decimal not supported {}", from_type->get_name())); | 1111 | 0 | } | 1112 | | | 1113 | 4 | return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments, | 1114 | 4 | uint32_t result, size_t input_rows_count, | 1115 | 4 | const NullMap::value_type* null_map = nullptr) { | 1116 | 4 | return cast_impl->execute_impl(context, block, arguments, result, input_rows_count, | 1117 | 4 | null_map); | 1118 | 4 | }; | 1119 | 4 | } |
_ZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE Line | Count | Source | 1088 | 3.23k | WrapperType create_decimal_wrapper(FunctionContext* context, const DataTypePtr& from_type) { | 1089 | 3.23k | std::shared_ptr<CastToBase> cast_impl; | 1090 | | | 1091 | 3.23k | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 3.23k | using Types = std::decay_t<decltype(types)>; | 1093 | 3.23k | using FromDataType = typename Types::LeftType; | 1094 | 3.23k | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 3.23k | if (context->enable_strict_mode()) { | 1096 | 3.23k | cast_impl = std::make_shared< | 1097 | 3.23k | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 3.23k | } else { | 1099 | 3.23k | cast_impl = std::make_shared< | 1100 | 3.23k | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 3.23k | } | 1102 | 3.23k | return true; | 1103 | 3.23k | } else { | 1104 | 3.23k | return false; | 1105 | 3.23k | } | 1106 | 3.23k | }; | 1107 | | | 1108 | 3.23k | if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) { | 1109 | 0 | return create_unsupport_wrapper( | 1110 | 0 | fmt::format("CAST AS decimal not supported {}", from_type->get_name())); | 1111 | 0 | } | 1112 | | | 1113 | 3.23k | return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments, | 1114 | 3.23k | uint32_t result, size_t input_rows_count, | 1115 | 3.23k | const NullMap::value_type* null_map = nullptr) { | 1116 | 3.23k | return cast_impl->execute_impl(context, block, arguments, result, input_rows_count, | 1117 | 3.23k | null_map); | 1118 | 3.23k | }; | 1119 | 3.23k | } |
_ZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE Line | Count | Source | 1088 | 3.21k | WrapperType create_decimal_wrapper(FunctionContext* context, const DataTypePtr& from_type) { | 1089 | 3.21k | std::shared_ptr<CastToBase> cast_impl; | 1090 | | | 1091 | 3.21k | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 3.21k | using Types = std::decay_t<decltype(types)>; | 1093 | 3.21k | using FromDataType = typename Types::LeftType; | 1094 | 3.21k | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 3.21k | if (context->enable_strict_mode()) { | 1096 | 3.21k | cast_impl = std::make_shared< | 1097 | 3.21k | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 3.21k | } else { | 1099 | 3.21k | cast_impl = std::make_shared< | 1100 | 3.21k | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 3.21k | } | 1102 | 3.21k | return true; | 1103 | 3.21k | } else { | 1104 | 3.21k | return false; | 1105 | 3.21k | } | 1106 | 3.21k | }; | 1107 | | | 1108 | 3.21k | if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) { | 1109 | 0 | return create_unsupport_wrapper( | 1110 | 0 | fmt::format("CAST AS decimal not supported {}", from_type->get_name())); | 1111 | 0 | } | 1112 | | | 1113 | 3.21k | return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments, | 1114 | 3.21k | uint32_t result, size_t input_rows_count, | 1115 | 3.21k | const NullMap::value_type* null_map = nullptr) { | 1116 | 3.21k | return cast_impl->execute_impl(context, block, arguments, result, input_rows_count, | 1117 | 3.21k | null_map); | 1118 | 3.21k | }; | 1119 | 3.21k | } |
_ZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE Line | Count | Source | 1088 | 3.01k | WrapperType create_decimal_wrapper(FunctionContext* context, const DataTypePtr& from_type) { | 1089 | 3.01k | std::shared_ptr<CastToBase> cast_impl; | 1090 | | | 1091 | 3.01k | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 3.01k | using Types = std::decay_t<decltype(types)>; | 1093 | 3.01k | using FromDataType = typename Types::LeftType; | 1094 | 3.01k | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 3.01k | if (context->enable_strict_mode()) { | 1096 | 3.01k | cast_impl = std::make_shared< | 1097 | 3.01k | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 3.01k | } else { | 1099 | 3.01k | cast_impl = std::make_shared< | 1100 | 3.01k | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 3.01k | } | 1102 | 3.01k | return true; | 1103 | 3.01k | } else { | 1104 | 3.01k | return false; | 1105 | 3.01k | } | 1106 | 3.01k | }; | 1107 | | | 1108 | 3.01k | if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) { | 1109 | 0 | return create_unsupport_wrapper( | 1110 | 0 | fmt::format("CAST AS decimal not supported {}", from_type->get_name())); | 1111 | 0 | } | 1112 | | | 1113 | 3.01k | return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments, | 1114 | 3.01k | uint32_t result, size_t input_rows_count, | 1115 | 3.01k | const NullMap::value_type* null_map = nullptr) { | 1116 | 3.01k | return cast_impl->execute_impl(context, block, arguments, result, input_rows_count, | 1117 | 3.01k | null_map); | 1118 | 3.01k | }; | 1119 | 3.01k | } |
_ZN5doris11CastWrapper22create_decimal_wrapperINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE Line | Count | Source | 1088 | 2.84k | WrapperType create_decimal_wrapper(FunctionContext* context, const DataTypePtr& from_type) { | 1089 | 2.84k | std::shared_ptr<CastToBase> cast_impl; | 1090 | | | 1091 | 2.84k | auto make_cast_wrapper = [&](const auto& types) -> bool { | 1092 | 2.84k | using Types = std::decay_t<decltype(types)>; | 1093 | 2.84k | using FromDataType = typename Types::LeftType; | 1094 | 2.84k | if constexpr (type_allow_cast_to_decimal<FromDataType>) { | 1095 | 2.84k | if (context->enable_strict_mode()) { | 1096 | 2.84k | cast_impl = std::make_shared< | 1097 | 2.84k | CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>(); | 1098 | 2.84k | } else { | 1099 | 2.84k | cast_impl = std::make_shared< | 1100 | 2.84k | CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>(); | 1101 | 2.84k | } | 1102 | 2.84k | return true; | 1103 | 2.84k | } else { | 1104 | 2.84k | return false; | 1105 | 2.84k | } | 1106 | 2.84k | }; | 1107 | | | 1108 | 2.84k | if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) { | 1109 | 0 | return create_unsupport_wrapper( | 1110 | 0 | fmt::format("CAST AS decimal not supported {}", from_type->get_name())); | 1111 | 0 | } | 1112 | | | 1113 | 2.84k | return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments, | 1114 | 2.84k | uint32_t result, size_t input_rows_count, | 1115 | 2.84k | const NullMap::value_type* null_map = nullptr) { | 1116 | 2.84k | return cast_impl->execute_impl(context, block, arguments, result, input_rows_count, | 1117 | 2.84k | null_map); | 1118 | 2.84k | }; | 1119 | 2.84k | } |
|
1120 | | } // namespace CastWrapper |
1121 | | #include "common/compile_check_end.h" |
1122 | | } // namespace doris |