be/src/exprs/function/cast/cast_to_int.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 <type_traits> |
21 | | |
22 | | #include "common/status.h" |
23 | | #include "core/data_type/data_type_decimal.h" |
24 | | #include "core/data_type/data_type_number.h" |
25 | | #include "core/data_type/primitive_type.h" |
26 | | #include "exprs/function/cast/cast_to_basic_number_common.h" |
27 | | |
28 | | namespace doris { |
29 | | |
30 | | // Types that can be cast to int: string, bool, int, float, double, decimal, date, datetime and time. |
31 | | // It's not supported to cast date to tinyint and smallint, because it will definitely overflow. |
32 | | // It's not supported to cast datetime to tinyint and smallint, because it will definitely overflow. |
33 | | // Casting from string and decimal types are handled in `cast_to_basic_number_common.h`. |
34 | | |
35 | | // may overflow if: |
36 | | // 1. from wider int to narrower int |
37 | | // 2. from float/double to int |
38 | | // 3. from time to tinyint, smallint and int |
39 | | template <typename FromDataType, typename ToDataType> |
40 | | constexpr bool CastToIntMayOverflow = |
41 | | (IsDataTypeInt<FromDataType> && |
42 | | sizeof(typename FromDataType::FieldType) > sizeof(typename ToDataType::FieldType)) || |
43 | | IsDataTypeFloat<FromDataType> || |
44 | | (std::is_same_v<FromDataType, DataTypeTimeV2> && |
45 | | (std::is_same_v<ToDataType, DataTypeInt32> || std::is_same_v<ToDataType, DataTypeInt16> || |
46 | | std::is_same_v<ToDataType, DataTypeInt8>)); |
47 | | |
48 | | // from number types and timev2 type to integer types which this cast may overflow -> result type is always nullable. |
49 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
50 | | requires(IsDataTypeInt<ToDataType> && |
51 | | (IsDataTypeNumber<FromDataType> || std::is_same_v<FromDataType, DataTypeTimeV2>) && |
52 | | CastToIntMayOverflow<FromDataType, ToDataType>) |
53 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
54 | | public: |
55 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
56 | | uint32_t result, size_t input_rows_count, |
57 | 1.25k | const NullMap::value_type* null_map = nullptr) const override { |
58 | 1.25k | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( |
59 | 1.25k | block.get_by_position(arguments[0]).column.get()); |
60 | 1.25k | if (!col_from) { |
61 | 0 | return Status::InternalError( |
62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", |
63 | 0 | type_to_string(FromDataType::PType), |
64 | 0 | block.get_by_position(arguments[0]).column->get_name())); |
65 | 0 | } |
66 | 1.25k | auto col_to = ToDataType::ColumnType::create(input_rows_count); |
67 | 707 | const auto& vec_from = col_from->get_data(); |
68 | 707 | auto& vec_to = col_to->get_data(); |
69 | 707 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); |
70 | 707 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); |
71 | | |
72 | 707 | CastParameters params; |
73 | 707 | params.is_strict = (CastMode == CastModeType::StrictMode); |
74 | 16.4k | for (size_t i = 0; i < input_rows_count; ++i) { |
75 | | // The source value of a row marked as null by the input null map is a hidden |
76 | | // payload and has no SQL semantics, so it must not be checked. |
77 | 14.5k | if (null_map && null_map[i]) { |
78 | 22 | continue; |
79 | 22 | } |
80 | 14.5k | if constexpr (IsDataTypeInt<FromDataType>) { |
81 | | // although always nullable output, but only set null when overflow in non-strict mode. |
82 | | // in strict mode, just raise error on overflow. |
83 | 12.6k | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { |
84 | 97 | if constexpr (CastMode == CastModeType::NonStrictMode) { |
85 | 46 | vec_null_map_to[i] = 1; |
86 | 46 | continue; |
87 | 51 | } else { |
88 | 51 | return params.status; |
89 | 51 | } |
90 | 97 | } |
91 | 12.6k | } else if constexpr (IsDataTypeFloat<FromDataType>) { |
92 | 899 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { |
93 | 312 | if constexpr (CastMode == CastModeType::NonStrictMode) { |
94 | 156 | vec_null_map_to[i] = 1; |
95 | 156 | continue; |
96 | 156 | } else { |
97 | 156 | return params.status; |
98 | 156 | } |
99 | 312 | } |
100 | 960 | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { |
101 | 960 | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { |
102 | 904 | if constexpr (CastMode == CastModeType::NonStrictMode) { |
103 | 452 | vec_null_map_to[i] = 1; |
104 | 452 | continue; |
105 | 452 | } else { |
106 | 452 | return params.status; |
107 | 452 | } |
108 | 904 | } |
109 | | } else { |
110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", |
111 | | type_to_string(FromDataType::PType), |
112 | | type_to_string(ToDataType::PType))); |
113 | | } |
114 | 14.5k | } |
115 | 1.19k | block.get_by_position(result).column = |
116 | 1.19k | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
117 | | |
118 | 1.19k | return Status::OK(); |
119 | 543 | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 5 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 5 | block.get_by_position(arguments[0]).column.get()); | 60 | 5 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 5 | const auto& vec_from = col_from->get_data(); | 68 | 5 | auto& vec_to = col_to->get_data(); | 69 | 5 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 5 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 5 | CastParameters params; | 73 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 18 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | 4 | } else { | 88 | 4 | return params.status; | 89 | 4 | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 5 | block.get_by_position(result).column = | 116 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 5 | return Status::OK(); | 119 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 19 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | 4 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | 4 | vec_null_map_to[i] = 1; | 86 | 4 | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 6 | block.get_by_position(result).column = | 116 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 6 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 37 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 37 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 37 | block.get_by_position(arguments[0]).column.get()); | 60 | 37 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 37 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 37 | const auto& vec_from = col_from->get_data(); | 68 | 37 | auto& vec_to = col_to->get_data(); | 69 | 37 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 37 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 37 | CastParameters params; | 73 | 37 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 100 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 63 | if (null_map && null_map[i]) { | 78 | 15 | continue; | 79 | 15 | } | 80 | 48 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 48 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | 15 | } else { | 88 | 15 | return params.status; | 89 | 15 | } | 90 | 15 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 48 | } | 115 | 37 | block.get_by_position(result).column = | 116 | 37 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 37 | return Status::OK(); | 119 | 37 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 7 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 7 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 7 | block.get_by_position(arguments[0]).column.get()); | 60 | 7 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 7 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 7 | const auto& vec_from = col_from->get_data(); | 68 | 7 | auto& vec_to = col_to->get_data(); | 69 | 7 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 7 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 7 | CastParameters params; | 73 | 7 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 45 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 29 | if (null_map && null_map[i]) { | 78 | 6 | continue; | 79 | 6 | } | 80 | 23 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 23 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | 9 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | 9 | vec_null_map_to[i] = 1; | 86 | 9 | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | 9 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 23 | } | 115 | 16 | block.get_by_position(result).column = | 116 | 16 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 16 | return Status::OK(); | 119 | 7 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 5 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 5 | block.get_by_position(arguments[0]).column.get()); | 60 | 5 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 5 | const auto& vec_from = col_from->get_data(); | 68 | 5 | auto& vec_to = col_to->get_data(); | 69 | 5 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 5 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 5 | CastParameters params; | 73 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 18 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | 4 | } else { | 88 | 4 | return params.status; | 89 | 4 | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 5 | block.get_by_position(result).column = | 116 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 5 | return Status::OK(); | 119 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 19 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | 4 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | 4 | vec_null_map_to[i] = 1; | 86 | 4 | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 6 | block.get_by_position(result).column = | 116 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 6 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 5 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 5 | block.get_by_position(arguments[0]).column.get()); | 60 | 5 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 5 | const auto& vec_from = col_from->get_data(); | 68 | 5 | auto& vec_to = col_to->get_data(); | 69 | 5 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 5 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 5 | CastParameters params; | 73 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 18 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | 4 | } else { | 88 | 4 | return params.status; | 89 | 4 | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 5 | block.get_by_position(result).column = | 116 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 5 | return Status::OK(); | 119 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 19 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | 4 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | 4 | vec_null_map_to[i] = 1; | 86 | 4 | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 6 | block.get_by_position(result).column = | 116 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 6 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 21 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 21 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 21 | block.get_by_position(arguments[0]).column.get()); | 60 | 21 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 21 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 21 | const auto& vec_from = col_from->get_data(); | 68 | 21 | auto& vec_to = col_to->get_data(); | 69 | 21 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 21 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 21 | CastParameters params; | 73 | 21 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 59 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 38 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 38 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 38 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | 20 | } else { | 97 | 20 | return params.status; | 98 | 20 | } | 99 | 20 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 38 | } | 115 | 21 | block.get_by_position(result).column = | 116 | 21 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 21 | return Status::OK(); | 119 | 21 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 60 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 38 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 38 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 38 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | 20 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | 20 | vec_null_map_to[i] = 1; | 95 | 20 | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | 20 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 38 | } | 115 | 22 | block.get_by_position(result).column = | 116 | 22 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 22 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 26 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 26 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 26 | block.get_by_position(arguments[0]).column.get()); | 60 | 26 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 26 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 26 | const auto& vec_from = col_from->get_data(); | 68 | 26 | auto& vec_to = col_to->get_data(); | 69 | 26 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 26 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 26 | CastParameters params; | 73 | 26 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 70 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 44 | if (null_map && null_map[i]) { | 78 | 1 | continue; | 79 | 1 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 43 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 43 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | 24 | } else { | 97 | 24 | return params.status; | 98 | 24 | } | 99 | 24 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 43 | } | 115 | 26 | block.get_by_position(result).column = | 116 | 26 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 26 | return Status::OK(); | 119 | 26 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 68 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 42 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 42 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 42 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | 24 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | 24 | vec_null_map_to[i] = 1; | 95 | 24 | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | 24 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 42 | } | 115 | 26 | block.get_by_position(result).column = | 116 | 26 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 26 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 160 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 160 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 160 | block.get_by_position(arguments[0]).column.get()); | 60 | 160 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 160 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 160 | const auto& vec_from = col_from->get_data(); | 68 | 160 | auto& vec_to = col_to->get_data(); | 69 | 160 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 160 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 160 | CastParameters params; | 73 | 160 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 320 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 160 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | 160 | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | 160 | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | 158 | } else { | 106 | 158 | return params.status; | 107 | 158 | } | 108 | 158 | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 160 | } | 115 | 160 | block.get_by_position(result).column = | 116 | 160 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 160 | return Status::OK(); | 119 | 160 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 160 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 160 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 160 | block.get_by_position(arguments[0]).column.get()); | 60 | 160 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 160 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 160 | const auto& vec_from = col_from->get_data(); | 68 | 160 | auto& vec_to = col_to->get_data(); | 69 | 160 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 160 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 160 | CastParameters params; | 73 | 160 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 478 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 160 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | 160 | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | 160 | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | 158 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | 158 | vec_null_map_to[i] = 1; | 104 | 158 | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | 158 | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 160 | } | 115 | 318 | block.get_by_position(result).column = | 116 | 318 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 318 | return Status::OK(); | 119 | 160 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 5 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 5 | block.get_by_position(arguments[0]).column.get()); | 60 | 5 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 5 | const auto& vec_from = col_from->get_data(); | 68 | 5 | auto& vec_to = col_to->get_data(); | 69 | 5 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 5 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 5 | CastParameters params; | 73 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 18 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | 4 | } else { | 88 | 4 | return params.status; | 89 | 4 | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 5 | block.get_by_position(result).column = | 116 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 5 | return Status::OK(); | 119 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 19 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | 4 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | 4 | vec_null_map_to[i] = 1; | 86 | 4 | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 6 | block.get_by_position(result).column = | 116 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 6 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 5 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 5 | block.get_by_position(arguments[0]).column.get()); | 60 | 5 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 5 | const auto& vec_from = col_from->get_data(); | 68 | 5 | auto& vec_to = col_to->get_data(); | 69 | 5 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 5 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 5 | CastParameters params; | 73 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 18 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | 4 | } else { | 88 | 4 | return params.status; | 89 | 4 | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 5 | block.get_by_position(result).column = | 116 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 5 | return Status::OK(); | 119 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 19 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | 4 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | 4 | vec_null_map_to[i] = 1; | 86 | 4 | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 6 | block.get_by_position(result).column = | 116 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 6 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 5 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 5 | block.get_by_position(arguments[0]).column.get()); | 60 | 5 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 5 | const auto& vec_from = col_from->get_data(); | 68 | 5 | auto& vec_to = col_to->get_data(); | 69 | 5 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 5 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 5 | CastParameters params; | 73 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 18 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | 4 | } else { | 88 | 4 | return params.status; | 89 | 4 | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 5 | block.get_by_position(result).column = | 116 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 5 | return Status::OK(); | 119 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 19 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | 4 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | 4 | vec_null_map_to[i] = 1; | 86 | 4 | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 6 | block.get_by_position(result).column = | 116 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 6 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 19 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 19 | block.get_by_position(arguments[0]).column.get()); | 60 | 19 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 19 | const auto& vec_from = col_from->get_data(); | 68 | 19 | auto& vec_to = col_to->get_data(); | 69 | 19 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 19 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 19 | CastParameters params; | 73 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 59 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 40 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 40 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 40 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | 18 | } else { | 97 | 18 | return params.status; | 98 | 18 | } | 99 | 18 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 40 | } | 115 | 19 | block.get_by_position(result).column = | 116 | 19 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 19 | return Status::OK(); | 119 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 60 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 40 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 40 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 40 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | 18 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | 18 | vec_null_map_to[i] = 1; | 95 | 18 | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | 18 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 40 | } | 115 | 20 | block.get_by_position(result).column = | 116 | 20 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 20 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 23 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 23 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 23 | block.get_by_position(arguments[0]).column.get()); | 60 | 23 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 23 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 23 | const auto& vec_from = col_from->get_data(); | 68 | 23 | auto& vec_to = col_to->get_data(); | 69 | 23 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 23 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 23 | CastParameters params; | 73 | 23 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 67 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 44 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 44 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 44 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | 22 | } else { | 97 | 22 | return params.status; | 98 | 22 | } | 99 | 22 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 44 | } | 115 | 23 | block.get_by_position(result).column = | 116 | 23 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 23 | return Status::OK(); | 119 | 23 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 68 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 44 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 44 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 44 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | 22 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | 22 | vec_null_map_to[i] = 1; | 95 | 22 | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | 22 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 44 | } | 115 | 24 | block.get_by_position(result).column = | 116 | 24 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 24 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 160 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 160 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 160 | block.get_by_position(arguments[0]).column.get()); | 60 | 160 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 160 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 160 | const auto& vec_from = col_from->get_data(); | 68 | 160 | auto& vec_to = col_to->get_data(); | 69 | 160 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 160 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 160 | CastParameters params; | 73 | 160 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 320 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 160 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | 160 | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | 160 | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | 158 | } else { | 106 | 158 | return params.status; | 107 | 158 | } | 108 | 158 | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 160 | } | 115 | 160 | block.get_by_position(result).column = | 116 | 160 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 160 | return Status::OK(); | 119 | 160 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 160 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 160 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 160 | block.get_by_position(arguments[0]).column.get()); | 60 | 160 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 160 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 160 | const auto& vec_from = col_from->get_data(); | 68 | 160 | auto& vec_to = col_to->get_data(); | 69 | 160 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 160 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 160 | CastParameters params; | 73 | 160 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 478 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 160 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | 160 | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | 160 | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | 158 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | 158 | vec_null_map_to[i] = 1; | 104 | 158 | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | 158 | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 160 | } | 115 | 318 | block.get_by_position(result).column = | 116 | 318 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 318 | return Status::OK(); | 119 | 160 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 5 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 5 | block.get_by_position(arguments[0]).column.get()); | 60 | 5 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 5 | const auto& vec_from = col_from->get_data(); | 68 | 5 | auto& vec_to = col_to->get_data(); | 69 | 5 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 5 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 5 | CastParameters params; | 73 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 18 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | 4 | } else { | 88 | 4 | return params.status; | 89 | 4 | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 5 | block.get_by_position(result).column = | 116 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 5 | return Status::OK(); | 119 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 41 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 41 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 41 | block.get_by_position(arguments[0]).column.get()); | 60 | 41 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 41 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 41 | const auto& vec_from = col_from->get_data(); | 68 | 41 | auto& vec_to = col_to->get_data(); | 69 | 41 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 41 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 41 | CastParameters params; | 73 | 41 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 12.4k | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 12.3k | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 12.3k | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 12.3k | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | 5 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | 5 | vec_null_map_to[i] = 1; | 86 | 5 | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | 5 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 12.3k | } | 115 | 46 | block.get_by_position(result).column = | 116 | 46 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 46 | return Status::OK(); | 119 | 41 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 5 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 5 | block.get_by_position(arguments[0]).column.get()); | 60 | 5 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 5 | const auto& vec_from = col_from->get_data(); | 68 | 5 | auto& vec_to = col_to->get_data(); | 69 | 5 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 5 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 5 | CastParameters params; | 73 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 18 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | 4 | } else { | 88 | 4 | return params.status; | 89 | 4 | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 5 | block.get_by_position(result).column = | 116 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 5 | return Status::OK(); | 119 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 19 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | 4 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | 4 | vec_null_map_to[i] = 1; | 86 | 4 | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 6 | block.get_by_position(result).column = | 116 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 6 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 15 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 15 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 15 | block.get_by_position(arguments[0]).column.get()); | 60 | 15 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 15 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 15 | const auto& vec_from = col_from->get_data(); | 68 | 15 | auto& vec_to = col_to->get_data(); | 69 | 15 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 15 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 15 | CastParameters params; | 73 | 15 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 59 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 44 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 44 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 44 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | 14 | } else { | 97 | 14 | return params.status; | 98 | 14 | } | 99 | 14 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 44 | } | 115 | 15 | block.get_by_position(result).column = | 116 | 15 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 15 | return Status::OK(); | 119 | 15 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 60 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 44 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 44 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 44 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | 14 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | 14 | vec_null_map_to[i] = 1; | 95 | 14 | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | 14 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 44 | } | 115 | 16 | block.get_by_position(result).column = | 116 | 16 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 16 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 19 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 19 | block.get_by_position(arguments[0]).column.get()); | 60 | 19 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 19 | const auto& vec_from = col_from->get_data(); | 68 | 19 | auto& vec_to = col_to->get_data(); | 69 | 19 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 19 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 19 | CastParameters params; | 73 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 67 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 48 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 48 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 48 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | 18 | } else { | 97 | 18 | return params.status; | 98 | 18 | } | 99 | 18 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 48 | } | 115 | 19 | block.get_by_position(result).column = | 116 | 19 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 19 | return Status::OK(); | 119 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 68 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 48 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 48 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 48 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | 18 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | 18 | vec_null_map_to[i] = 1; | 95 | 18 | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | 18 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 48 | } | 115 | 20 | block.get_by_position(result).column = | 116 | 20 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 20 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 138 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 138 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 138 | block.get_by_position(arguments[0]).column.get()); | 60 | 138 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 138 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 138 | const auto& vec_from = col_from->get_data(); | 68 | 138 | auto& vec_to = col_to->get_data(); | 69 | 138 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 138 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 138 | CastParameters params; | 73 | 138 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 298 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 160 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | 160 | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | 160 | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | 136 | } else { | 106 | 136 | return params.status; | 107 | 136 | } | 108 | 136 | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 160 | } | 115 | 138 | block.get_by_position(result).column = | 116 | 138 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 138 | return Status::OK(); | 119 | 138 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 138 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 138 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 138 | block.get_by_position(arguments[0]).column.get()); | 60 | 138 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 138 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 138 | const auto& vec_from = col_from->get_data(); | 68 | 138 | auto& vec_to = col_to->get_data(); | 69 | 138 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 138 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 138 | CastParameters params; | 73 | 138 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 434 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 160 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | 160 | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | 160 | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | 136 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | 136 | vec_null_map_to[i] = 1; | 104 | 136 | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | 136 | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 160 | } | 115 | 274 | block.get_by_position(result).column = | 116 | 274 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 274 | return Status::OK(); | 119 | 138 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 5 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 5 | block.get_by_position(arguments[0]).column.get()); | 60 | 5 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 5 | const auto& vec_from = col_from->get_data(); | 68 | 5 | auto& vec_to = col_to->get_data(); | 69 | 5 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 5 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 5 | CastParameters params; | 73 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 18 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | 4 | } else { | 88 | 4 | return params.status; | 89 | 4 | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 5 | block.get_by_position(result).column = | 116 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 5 | return Status::OK(); | 119 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 19 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 13 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | 13 | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | 13 | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | 4 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | 4 | vec_null_map_to[i] = 1; | 86 | 4 | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | 4 | } | 91 | | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 13 | } | 115 | 6 | block.get_by_position(result).column = | 116 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 6 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 11 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 11 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 11 | block.get_by_position(arguments[0]).column.get()); | 60 | 11 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 11 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 11 | const auto& vec_from = col_from->get_data(); | 68 | 11 | auto& vec_to = col_to->get_data(); | 69 | 11 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 11 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 11 | CastParameters params; | 73 | 11 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 57 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 46 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 46 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 46 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | 10 | } else { | 97 | 10 | return params.status; | 98 | 10 | } | 99 | 10 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 46 | } | 115 | 11 | block.get_by_position(result).column = | 116 | 11 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 11 | return Status::OK(); | 119 | 11 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 58 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 46 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 46 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 46 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | 10 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | 10 | vec_null_map_to[i] = 1; | 95 | 10 | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | 10 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 46 | } | 115 | 12 | block.get_by_position(result).column = | 116 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 12 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 15 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 15 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 15 | block.get_by_position(arguments[0]).column.get()); | 60 | 15 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 15 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 15 | const auto& vec_from = col_from->get_data(); | 68 | 15 | auto& vec_to = col_to->get_data(); | 69 | 15 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 15 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 15 | CastParameters params; | 73 | 15 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 65 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 50 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 50 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 50 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | 14 | } else { | 97 | 14 | return params.status; | 98 | 14 | } | 99 | 14 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 50 | } | 115 | 15 | block.get_by_position(result).column = | 116 | 15 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 15 | return Status::OK(); | 119 | 15 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 3 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 3 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 3 | block.get_by_position(arguments[0]).column.get()); | 60 | 3 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 3 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 3 | const auto& vec_from = col_from->get_data(); | 68 | 3 | auto& vec_to = col_to->get_data(); | 69 | 3 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 3 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 3 | CastParameters params; | 73 | 3 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 69 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 52 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 52 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 52 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | 14 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | 14 | vec_null_map_to[i] = 1; | 95 | 14 | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | 14 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 52 | } | 115 | 17 | block.get_by_position(result).column = | 116 | 17 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 17 | return Status::OK(); | 119 | 3 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 7 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 7 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 7 | block.get_by_position(arguments[0]).column.get()); | 60 | 7 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 7 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 7 | const auto& vec_from = col_from->get_data(); | 68 | 7 | auto& vec_to = col_to->get_data(); | 69 | 7 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 7 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 7 | CastParameters params; | 73 | 7 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 53 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 46 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 46 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 46 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | 6 | } else { | 97 | 6 | return params.status; | 98 | 6 | } | 99 | 6 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 46 | } | 115 | 7 | block.get_by_position(result).column = | 116 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 7 | return Status::OK(); | 119 | 7 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 54 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 46 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 46 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 46 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | 6 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | 6 | vec_null_map_to[i] = 1; | 95 | 6 | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | 6 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 46 | } | 115 | 8 | block.get_by_position(result).column = | 116 | 8 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 8 | return Status::OK(); | 119 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 11 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 11 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 11 | block.get_by_position(arguments[0]).column.get()); | 60 | 11 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 11 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 11 | const auto& vec_from = col_from->get_data(); | 68 | 11 | auto& vec_to = col_to->get_data(); | 69 | 11 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 11 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 11 | CastParameters params; | 73 | 11 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 61 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 50 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 50 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 50 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | | vec_null_map_to[i] = 1; | 95 | | continue; | 96 | 10 | } else { | 97 | 10 | return params.status; | 98 | 10 | } | 99 | 10 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 50 | } | 115 | 11 | block.get_by_position(result).column = | 116 | 11 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 11 | return Status::OK(); | 119 | 11 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 57 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 58 | 2 | const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>( | 59 | 2 | block.get_by_position(arguments[0]).column.get()); | 60 | 2 | if (!col_from) { | 61 | 0 | return Status::InternalError( | 62 | 0 | fmt::format("Column type mismatch: expected {}, got {}", | 63 | 0 | type_to_string(FromDataType::PType), | 64 | 0 | block.get_by_position(arguments[0]).column->get_name())); | 65 | 0 | } | 66 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 67 | 2 | const auto& vec_from = col_from->get_data(); | 68 | 2 | auto& vec_to = col_to->get_data(); | 69 | 2 | ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0); | 70 | 2 | NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data(); | 71 | | | 72 | 2 | CastParameters params; | 73 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 74 | 62 | for (size_t i = 0; i < input_rows_count; ++i) { | 75 | | // The source value of a row marked as null by the input null map is a hidden | 76 | | // payload and has no SQL semantics, so it must not be checked. | 77 | 50 | if (null_map && null_map[i]) { | 78 | 0 | continue; | 79 | 0 | } | 80 | | if constexpr (IsDataTypeInt<FromDataType>) { | 81 | | // although always nullable output, but only set null when overflow in non-strict mode. | 82 | | // in strict mode, just raise error on overflow. | 83 | | if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) { | 84 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 85 | | vec_null_map_to[i] = 1; | 86 | | continue; | 87 | | } else { | 88 | | return params.status; | 89 | | } | 90 | | } | 91 | 50 | } else if constexpr (IsDataTypeFloat<FromDataType>) { | 92 | 50 | if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) { | 93 | 10 | if constexpr (CastMode == CastModeType::NonStrictMode) { | 94 | 10 | vec_null_map_to[i] = 1; | 95 | 10 | continue; | 96 | | } else { | 97 | | return params.status; | 98 | | } | 99 | 10 | } | 100 | | } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) { | 101 | | if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) { | 102 | | if constexpr (CastMode == CastModeType::NonStrictMode) { | 103 | | vec_null_map_to[i] = 1; | 104 | | continue; | 105 | | } else { | 106 | | return params.status; | 107 | | } | 108 | | } | 109 | | } else { | 110 | | return Status::InternalError(fmt::format("Unsupported cast from {} to {}", | 111 | | type_to_string(FromDataType::PType), | 112 | | type_to_string(ToDataType::PType))); | 113 | | } | 114 | 50 | } | 115 | 12 | block.get_by_position(result).column = | 116 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 117 | | | 118 | 12 | return Status::OK(); | 119 | 2 | } |
|
120 | | }; |
121 | | |
122 | | /// cast to int, will not overflow and no nullable output: |
123 | | /// 1. from bool; |
124 | | /// 2. from narrow int to wider int |
125 | | /// 3. from time to bigint and largeint |
126 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
127 | | requires(IsDataTypeInt<ToDataType> && |
128 | | (IsDataTypeNumber<FromDataType> || std::is_same_v<FromDataType, DataTypeTimeV2>) && |
129 | | !CastToIntMayOverflow<FromDataType, ToDataType>) |
130 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
131 | | public: |
132 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
133 | | uint32_t result, size_t input_rows_count, |
134 | 62 | const NullMap::value_type* null_map = nullptr) const override { |
135 | 62 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, |
136 | 62 | input_rows_count); |
137 | 62 | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 2 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 2 | input_rows_count); | 137 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 2 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 2 | input_rows_count); | 137 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 2 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 2 | input_rows_count); | 137 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 2 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 2 | input_rows_count); | 137 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 4 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 4 | input_rows_count); | 137 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 18 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 18 | input_rows_count); | 137 | 18 | } |
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 2 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 2 | input_rows_count); | 137 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 2 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 2 | input_rows_count); | 137 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 1 | input_rows_count); | 137 | 1 | } |
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 2 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 2 | input_rows_count); | 137 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 134 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 135 | 2 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 136 | 2 | input_rows_count); | 137 | 2 | } |
|
138 | | }; |
139 | | |
140 | | // cast decimal to integer. always use overflow check to decide nullable |
141 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
142 | | requires(IsDataTypeInt<ToDataType> && IsDataTypeDecimal<FromDataType>) |
143 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
144 | | public: |
145 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
146 | | uint32_t result, size_t input_rows_count, |
147 | 380 | const NullMap::value_type* null_map = nullptr) const override { |
148 | 380 | using ToFieldType = typename ToDataType::FieldType; |
149 | | |
150 | 380 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
151 | 380 | const auto* col_from = |
152 | 380 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
153 | 380 | if (!col_from) { |
154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", |
155 | 0 | type_to_string(FromDataType::PType), |
156 | 0 | named_from.column->get_name())); |
157 | 0 | } |
158 | 380 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); |
159 | 380 | UInt32 from_precision = from_decimal_type.get_precision(); |
160 | 380 | UInt32 from_scale = from_decimal_type.get_scale(); |
161 | | |
162 | | // may overflow if integer part of decimal is larger than to_max_digits |
163 | | // in strict mode we also decide nullable on this. |
164 | 380 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); |
165 | 380 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; |
166 | | // only in non-strict mode and may overflow, we set nullable |
167 | 380 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; |
168 | | |
169 | 380 | auto col_to = ToDataType::ColumnType::create(input_rows_count); |
170 | 380 | const auto& vec_from = col_from->get_data(); |
171 | 380 | const auto* vec_from_data = vec_from.data(); |
172 | 380 | auto& vec_to = col_to->get_data(); |
173 | 380 | auto* vec_to_data = vec_to.data(); |
174 | | |
175 | 380 | ColumnUInt8::MutablePtr col_null_map_to; |
176 | 380 | NullMap::value_type* null_map_data = nullptr; |
177 | 380 | if (overflow_and_nullable) { |
178 | 146 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); |
179 | 146 | null_map_data = col_null_map_to->get_data().data(); |
180 | 146 | } |
181 | | |
182 | 380 | CastParameters params; |
183 | 380 | params.is_strict = (CastMode == CastModeType::StrictMode); |
184 | 380 | size_t size = vec_from.size(); |
185 | 22.4k | for (size_t i = 0; i < size; i++) { |
186 | | // Skip hidden payload of rows marked as null by the input null map. |
187 | 22.1k | if (null_map && null_map[i]) { |
188 | 0 | continue; |
189 | 0 | } |
190 | 22.1k | if (!CastToInt::from_decimal<typename FromDataType::FieldType, |
191 | 22.1k | typename ToDataType::FieldType>( |
192 | 22.1k | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { |
193 | 0 | if (set_nullable) { |
194 | 0 | null_map_data[i] = 1; |
195 | 0 | } else { |
196 | 0 | return params.status; |
197 | 0 | } |
198 | 0 | } |
199 | 22.1k | } |
200 | | |
201 | 380 | if (overflow_and_nullable) { |
202 | 146 | block.get_by_position(result).column = |
203 | 146 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
204 | 234 | } else { |
205 | 234 | block.get_by_position(result).column = std::move(col_to); |
206 | 234 | } |
207 | 380 | return Status::OK(); |
208 | 380 | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 7 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 7 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 7 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 7 | const auto* col_from = | 152 | 7 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 7 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 7 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 7 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 7 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 7 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 7 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 7 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 7 | const auto& vec_from = col_from->get_data(); | 171 | 7 | const auto* vec_from_data = vec_from.data(); | 172 | 7 | auto& vec_to = col_to->get_data(); | 173 | 7 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 7 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 7 | NullMap::value_type* null_map_data = nullptr; | 177 | 7 | if (overflow_and_nullable) { | 178 | 3 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 3 | null_map_data = col_null_map_to->get_data().data(); | 180 | 3 | } | 181 | | | 182 | 7 | CastParameters params; | 183 | 7 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 7 | size_t size = vec_from.size(); | 185 | 302 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 295 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 295 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 295 | typename ToDataType::FieldType>( | 192 | 295 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 295 | } | 200 | | | 201 | 7 | if (overflow_and_nullable) { | 202 | 3 | block.get_by_position(result).column = | 203 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 7 | return Status::OK(); | 208 | 7 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 7 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 7 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 7 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 7 | const auto* col_from = | 152 | 7 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 7 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 7 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 7 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 7 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 7 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 7 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 7 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 7 | const auto& vec_from = col_from->get_data(); | 171 | 7 | const auto* vec_from_data = vec_from.data(); | 172 | 7 | auto& vec_to = col_to->get_data(); | 173 | 7 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 7 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 7 | NullMap::value_type* null_map_data = nullptr; | 177 | 7 | if (overflow_and_nullable) { | 178 | 3 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 3 | null_map_data = col_null_map_to->get_data().data(); | 180 | 3 | } | 181 | | | 182 | 7 | CastParameters params; | 183 | 7 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 7 | size_t size = vec_from.size(); | 185 | 302 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 295 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 295 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 295 | typename ToDataType::FieldType>( | 192 | 295 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 295 | } | 200 | | | 201 | 7 | if (overflow_and_nullable) { | 202 | 3 | block.get_by_position(result).column = | 203 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 7 | return Status::OK(); | 208 | 7 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 4 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 4 | const auto* col_from = | 152 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 4 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 4 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 4 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 4 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 4 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 4 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 4 | const auto& vec_from = col_from->get_data(); | 171 | 4 | const auto* vec_from_data = vec_from.data(); | 172 | 4 | auto& vec_to = col_to->get_data(); | 173 | 4 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 4 | NullMap::value_type* null_map_data = nullptr; | 177 | 4 | if (overflow_and_nullable) { | 178 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 4 | null_map_data = col_null_map_to->get_data().data(); | 180 | 4 | } | 181 | | | 182 | 4 | CastParameters params; | 183 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 4 | size_t size = vec_from.size(); | 185 | 148 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 144 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 144 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 144 | typename ToDataType::FieldType>( | 192 | 144 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 144 | } | 200 | | | 201 | 4 | if (overflow_and_nullable) { | 202 | 4 | block.get_by_position(result).column = | 203 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 0 | block.get_by_position(result).column = std::move(col_to); | 206 | 0 | } | 207 | 4 | return Status::OK(); | 208 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 4 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 4 | const auto* col_from = | 152 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 4 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 4 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 4 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 4 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 4 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 4 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 4 | const auto& vec_from = col_from->get_data(); | 171 | 4 | const auto* vec_from_data = vec_from.data(); | 172 | 4 | auto& vec_to = col_to->get_data(); | 173 | 4 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 4 | NullMap::value_type* null_map_data = nullptr; | 177 | 4 | if (overflow_and_nullable) { | 178 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 4 | null_map_data = col_null_map_to->get_data().data(); | 180 | 4 | } | 181 | | | 182 | 4 | CastParameters params; | 183 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 4 | size_t size = vec_from.size(); | 185 | 148 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 144 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 144 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 144 | typename ToDataType::FieldType>( | 192 | 144 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 144 | } | 200 | | | 201 | 4 | if (overflow_and_nullable) { | 202 | 4 | block.get_by_position(result).column = | 203 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 0 | block.get_by_position(result).column = std::move(col_to); | 206 | 0 | } | 207 | 4 | return Status::OK(); | 208 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 7 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 7 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 7 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 7 | const auto* col_from = | 152 | 7 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 7 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 7 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 7 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 7 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 7 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 7 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 7 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 7 | const auto& vec_from = col_from->get_data(); | 171 | 7 | const auto* vec_from_data = vec_from.data(); | 172 | 7 | auto& vec_to = col_to->get_data(); | 173 | 7 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 7 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 7 | NullMap::value_type* null_map_data = nullptr; | 177 | 7 | if (overflow_and_nullable) { | 178 | 3 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 3 | null_map_data = col_null_map_to->get_data().data(); | 180 | 3 | } | 181 | | | 182 | 7 | CastParameters params; | 183 | 7 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 7 | size_t size = vec_from.size(); | 185 | 302 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 295 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 295 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 295 | typename ToDataType::FieldType>( | 192 | 295 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 295 | } | 200 | | | 201 | 7 | if (overflow_and_nullable) { | 202 | 3 | block.get_by_position(result).column = | 203 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 7 | return Status::OK(); | 208 | 7 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 7 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 7 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 7 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 7 | const auto* col_from = | 152 | 7 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 7 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 7 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 7 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 7 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 7 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 7 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 7 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 7 | const auto& vec_from = col_from->get_data(); | 171 | 7 | const auto* vec_from_data = vec_from.data(); | 172 | 7 | auto& vec_to = col_to->get_data(); | 173 | 7 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 7 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 7 | NullMap::value_type* null_map_data = nullptr; | 177 | 7 | if (overflow_and_nullable) { | 178 | 3 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 3 | null_map_data = col_null_map_to->get_data().data(); | 180 | 3 | } | 181 | | | 182 | 7 | CastParameters params; | 183 | 7 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 7 | size_t size = vec_from.size(); | 185 | 302 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 295 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 295 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 295 | typename ToDataType::FieldType>( | 192 | 295 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 295 | } | 200 | | | 201 | 7 | if (overflow_and_nullable) { | 202 | 3 | block.get_by_position(result).column = | 203 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 7 | return Status::OK(); | 208 | 7 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 4 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 4 | const auto* col_from = | 152 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 4 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 4 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 4 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 4 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 4 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 4 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 4 | const auto& vec_from = col_from->get_data(); | 171 | 4 | const auto* vec_from_data = vec_from.data(); | 172 | 4 | auto& vec_to = col_to->get_data(); | 173 | 4 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 4 | NullMap::value_type* null_map_data = nullptr; | 177 | 4 | if (overflow_and_nullable) { | 178 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 4 | null_map_data = col_null_map_to->get_data().data(); | 180 | 4 | } | 181 | | | 182 | 4 | CastParameters params; | 183 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 4 | size_t size = vec_from.size(); | 185 | 148 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 144 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 144 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 144 | typename ToDataType::FieldType>( | 192 | 144 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 144 | } | 200 | | | 201 | 4 | if (overflow_and_nullable) { | 202 | 4 | block.get_by_position(result).column = | 203 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 0 | block.get_by_position(result).column = std::move(col_to); | 206 | 0 | } | 207 | 4 | return Status::OK(); | 208 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 4 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 4 | const auto* col_from = | 152 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 4 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 4 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 4 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 4 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 4 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 4 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 4 | const auto& vec_from = col_from->get_data(); | 171 | 4 | const auto* vec_from_data = vec_from.data(); | 172 | 4 | auto& vec_to = col_to->get_data(); | 173 | 4 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 4 | NullMap::value_type* null_map_data = nullptr; | 177 | 4 | if (overflow_and_nullable) { | 178 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 4 | null_map_data = col_null_map_to->get_data().data(); | 180 | 4 | } | 181 | | | 182 | 4 | CastParameters params; | 183 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 4 | size_t size = vec_from.size(); | 185 | 148 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 144 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 144 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 144 | typename ToDataType::FieldType>( | 192 | 144 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 144 | } | 200 | | | 201 | 4 | if (overflow_and_nullable) { | 202 | 4 | block.get_by_position(result).column = | 203 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 0 | block.get_by_position(result).column = std::move(col_to); | 206 | 0 | } | 207 | 4 | return Status::OK(); | 208 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 7 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 7 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 7 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 7 | const auto* col_from = | 152 | 7 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 7 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 7 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 7 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 7 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 7 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 7 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 7 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 7 | const auto& vec_from = col_from->get_data(); | 171 | 7 | const auto* vec_from_data = vec_from.data(); | 172 | 7 | auto& vec_to = col_to->get_data(); | 173 | 7 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 7 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 7 | NullMap::value_type* null_map_data = nullptr; | 177 | 7 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 7 | CastParameters params; | 183 | 7 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 7 | size_t size = vec_from.size(); | 185 | 455 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 448 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 448 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 448 | typename ToDataType::FieldType>( | 192 | 448 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 448 | } | 200 | | | 201 | 7 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 7 | } else { | 205 | 7 | block.get_by_position(result).column = std::move(col_to); | 206 | 7 | } | 207 | 7 | return Status::OK(); | 208 | 7 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 7 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 7 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 7 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 7 | const auto* col_from = | 152 | 7 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 7 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 7 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 7 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 7 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 7 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 7 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 7 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 7 | const auto& vec_from = col_from->get_data(); | 171 | 7 | const auto* vec_from_data = vec_from.data(); | 172 | 7 | auto& vec_to = col_to->get_data(); | 173 | 7 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 7 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 7 | NullMap::value_type* null_map_data = nullptr; | 177 | 7 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 7 | CastParameters params; | 183 | 7 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 7 | size_t size = vec_from.size(); | 185 | 455 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 448 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 448 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 448 | typename ToDataType::FieldType>( | 192 | 448 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 448 | } | 200 | | | 201 | 7 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 7 | } else { | 205 | 7 | block.get_by_position(result).column = std::move(col_to); | 206 | 7 | } | 207 | 7 | return Status::OK(); | 208 | 7 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 3 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 3 | null_map_data = col_null_map_to->get_data().data(); | 180 | 3 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 623 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 614 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 614 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 614 | typename ToDataType::FieldType>( | 192 | 614 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 614 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 3 | block.get_by_position(result).column = | 203 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 6 | } else { | 205 | 6 | block.get_by_position(result).column = std::move(col_to); | 206 | 6 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 3 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 3 | null_map_data = col_null_map_to->get_data().data(); | 180 | 3 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 623 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 614 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 614 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 614 | typename ToDataType::FieldType>( | 192 | 614 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 614 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 3 | block.get_by_position(result).column = | 203 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 6 | } else { | 205 | 6 | block.get_by_position(result).column = std::move(col_to); | 206 | 6 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 4 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 4 | const auto* col_from = | 152 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 4 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 4 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 4 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 4 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 4 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 4 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 4 | const auto& vec_from = col_from->get_data(); | 171 | 4 | const auto* vec_from_data = vec_from.data(); | 172 | 4 | auto& vec_to = col_to->get_data(); | 173 | 4 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 4 | NullMap::value_type* null_map_data = nullptr; | 177 | 4 | if (overflow_and_nullable) { | 178 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 4 | null_map_data = col_null_map_to->get_data().data(); | 180 | 4 | } | 181 | | | 182 | 4 | CastParameters params; | 183 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 4 | size_t size = vec_from.size(); | 185 | 148 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 144 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 144 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 144 | typename ToDataType::FieldType>( | 192 | 144 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 144 | } | 200 | | | 201 | 4 | if (overflow_and_nullable) { | 202 | 4 | block.get_by_position(result).column = | 203 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 0 | block.get_by_position(result).column = std::move(col_to); | 206 | 0 | } | 207 | 4 | return Status::OK(); | 208 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 4 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 4 | const auto* col_from = | 152 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 4 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 4 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 4 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 4 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 4 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 4 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 4 | const auto& vec_from = col_from->get_data(); | 171 | 4 | const auto* vec_from_data = vec_from.data(); | 172 | 4 | auto& vec_to = col_to->get_data(); | 173 | 4 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 4 | NullMap::value_type* null_map_data = nullptr; | 177 | 4 | if (overflow_and_nullable) { | 178 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 4 | null_map_data = col_null_map_to->get_data().data(); | 180 | 4 | } | 181 | | | 182 | 4 | CastParameters params; | 183 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 4 | size_t size = vec_from.size(); | 185 | 148 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 144 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 144 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 144 | typename ToDataType::FieldType>( | 192 | 144 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 144 | } | 200 | | | 201 | 4 | if (overflow_and_nullable) { | 202 | 4 | block.get_by_position(result).column = | 203 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 0 | block.get_by_position(result).column = std::move(col_to); | 206 | 0 | } | 207 | 4 | return Status::OK(); | 208 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 7 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 7 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 7 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 7 | const auto* col_from = | 152 | 7 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 7 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 7 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 7 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 7 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 7 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 7 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 7 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 7 | const auto& vec_from = col_from->get_data(); | 171 | 7 | const auto* vec_from_data = vec_from.data(); | 172 | 7 | auto& vec_to = col_to->get_data(); | 173 | 7 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 7 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 7 | NullMap::value_type* null_map_data = nullptr; | 177 | 7 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 7 | CastParameters params; | 183 | 7 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 7 | size_t size = vec_from.size(); | 185 | 455 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 448 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 448 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 448 | typename ToDataType::FieldType>( | 192 | 448 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 448 | } | 200 | | | 201 | 7 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 7 | } else { | 205 | 7 | block.get_by_position(result).column = std::move(col_to); | 206 | 7 | } | 207 | 7 | return Status::OK(); | 208 | 7 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 7 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 7 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 7 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 7 | const auto* col_from = | 152 | 7 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 7 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 7 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 7 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 7 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 7 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 7 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 7 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 7 | const auto& vec_from = col_from->get_data(); | 171 | 7 | const auto* vec_from_data = vec_from.data(); | 172 | 7 | auto& vec_to = col_to->get_data(); | 173 | 7 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 7 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 7 | NullMap::value_type* null_map_data = nullptr; | 177 | 7 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 7 | CastParameters params; | 183 | 7 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 7 | size_t size = vec_from.size(); | 185 | 455 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 448 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 448 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 448 | typename ToDataType::FieldType>( | 192 | 448 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 448 | } | 200 | | | 201 | 7 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 7 | } else { | 205 | 7 | block.get_by_position(result).column = std::move(col_to); | 206 | 7 | } | 207 | 7 | return Status::OK(); | 208 | 7 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 713 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 704 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 704 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 704 | typename ToDataType::FieldType>( | 192 | 704 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 704 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 9 | } else { | 205 | 9 | block.get_by_position(result).column = std::move(col_to); | 206 | 9 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 713 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 704 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 704 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 704 | typename ToDataType::FieldType>( | 192 | 704 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 704 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 9 | } else { | 205 | 9 | block.get_by_position(result).column = std::move(col_to); | 206 | 9 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 4 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 4 | const auto* col_from = | 152 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 4 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 4 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 4 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 4 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 4 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 4 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 4 | const auto& vec_from = col_from->get_data(); | 171 | 4 | const auto* vec_from_data = vec_from.data(); | 172 | 4 | auto& vec_to = col_to->get_data(); | 173 | 4 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 4 | NullMap::value_type* null_map_data = nullptr; | 177 | 4 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 4 | CastParameters params; | 183 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 4 | size_t size = vec_from.size(); | 185 | 292 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 288 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 288 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 288 | typename ToDataType::FieldType>( | 192 | 288 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 288 | } | 200 | | | 201 | 4 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 4 | return Status::OK(); | 208 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 4 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 4 | const auto* col_from = | 152 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 4 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 4 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 4 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 4 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 4 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 4 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 4 | const auto& vec_from = col_from->get_data(); | 171 | 4 | const auto* vec_from_data = vec_from.data(); | 172 | 4 | auto& vec_to = col_to->get_data(); | 173 | 4 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 4 | NullMap::value_type* null_map_data = nullptr; | 177 | 4 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 4 | CastParameters params; | 183 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 4 | size_t size = vec_from.size(); | 185 | 292 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 288 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 288 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 288 | typename ToDataType::FieldType>( | 192 | 288 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 288 | } | 200 | | | 201 | 4 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 4 | return Status::OK(); | 208 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 4 | null_map_data = col_null_map_to->get_data().data(); | 180 | 4 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 551 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 542 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 542 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 542 | typename ToDataType::FieldType>( | 192 | 542 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 542 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 4 | block.get_by_position(result).column = | 203 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 5 | block.get_by_position(result).column = std::move(col_to); | 206 | 5 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 4 | null_map_data = col_null_map_to->get_data().data(); | 180 | 4 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 551 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 542 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 542 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 542 | typename ToDataType::FieldType>( | 192 | 542 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 542 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 4 | block.get_by_position(result).column = | 203 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 5 | block.get_by_position(result).column = std::move(col_to); | 206 | 5 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 5 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 5 | null_map_data = col_null_map_to->get_data().data(); | 180 | 5 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 479 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 470 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 470 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 470 | typename ToDataType::FieldType>( | 192 | 470 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 470 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 5 | block.get_by_position(result).column = | 203 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 5 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 7 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 7 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 7 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 7 | const auto* col_from = | 152 | 7 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 7 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 7 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 7 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 7 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 7 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 7 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 7 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 7 | const auto& vec_from = col_from->get_data(); | 171 | 7 | const auto* vec_from_data = vec_from.data(); | 172 | 7 | auto& vec_to = col_to->get_data(); | 173 | 7 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 7 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 7 | NullMap::value_type* null_map_data = nullptr; | 177 | 7 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 7 | CastParameters params; | 183 | 7 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 7 | size_t size = vec_from.size(); | 185 | 455 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 448 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 448 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 448 | typename ToDataType::FieldType>( | 192 | 448 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 448 | } | 200 | | | 201 | 7 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 7 | } else { | 205 | 7 | block.get_by_position(result).column = std::move(col_to); | 206 | 7 | } | 207 | 7 | return Status::OK(); | 208 | 7 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 7 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 7 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 7 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 7 | const auto* col_from = | 152 | 7 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 7 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 7 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 7 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 7 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 7 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 7 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 7 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 7 | const auto& vec_from = col_from->get_data(); | 171 | 7 | const auto* vec_from_data = vec_from.data(); | 172 | 7 | auto& vec_to = col_to->get_data(); | 173 | 7 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 7 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 7 | NullMap::value_type* null_map_data = nullptr; | 177 | 7 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 7 | CastParameters params; | 183 | 7 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 7 | size_t size = vec_from.size(); | 185 | 455 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 448 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 448 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 448 | typename ToDataType::FieldType>( | 192 | 448 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 448 | } | 200 | | | 201 | 7 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 7 | } else { | 205 | 7 | block.get_by_position(result).column = std::move(col_to); | 206 | 7 | } | 207 | 7 | return Status::OK(); | 208 | 7 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 713 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 704 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 704 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 704 | typename ToDataType::FieldType>( | 192 | 704 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 704 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 9 | } else { | 205 | 9 | block.get_by_position(result).column = std::move(col_to); | 206 | 9 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 713 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 704 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 704 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 704 | typename ToDataType::FieldType>( | 192 | 704 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 704 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 9 | } else { | 205 | 9 | block.get_by_position(result).column = std::move(col_to); | 206 | 9 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 4 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 4 | const auto* col_from = | 152 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 4 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 4 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 4 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 4 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 4 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 4 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 4 | const auto& vec_from = col_from->get_data(); | 171 | 4 | const auto* vec_from_data = vec_from.data(); | 172 | 4 | auto& vec_to = col_to->get_data(); | 173 | 4 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 4 | NullMap::value_type* null_map_data = nullptr; | 177 | 4 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 4 | CastParameters params; | 183 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 4 | size_t size = vec_from.size(); | 185 | 292 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 288 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 288 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 288 | typename ToDataType::FieldType>( | 192 | 288 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 288 | } | 200 | | | 201 | 4 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 4 | return Status::OK(); | 208 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 4 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 4 | const auto* col_from = | 152 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 4 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 4 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 4 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 4 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 4 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 4 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 4 | const auto& vec_from = col_from->get_data(); | 171 | 4 | const auto* vec_from_data = vec_from.data(); | 172 | 4 | auto& vec_to = col_to->get_data(); | 173 | 4 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 4 | NullMap::value_type* null_map_data = nullptr; | 177 | 4 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 4 | CastParameters params; | 183 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 4 | size_t size = vec_from.size(); | 185 | 292 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 288 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 288 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 288 | typename ToDataType::FieldType>( | 192 | 288 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 288 | } | 200 | | | 201 | 4 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 4 | } else { | 205 | 4 | block.get_by_position(result).column = std::move(col_to); | 206 | 4 | } | 207 | 4 | return Status::OK(); | 208 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 713 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 704 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 704 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 704 | typename ToDataType::FieldType>( | 192 | 704 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 704 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 9 | } else { | 205 | 9 | block.get_by_position(result).column = std::move(col_to); | 206 | 9 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 0 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 0 | null_map_data = col_null_map_to->get_data().data(); | 180 | 0 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 713 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 704 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 704 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 704 | typename ToDataType::FieldType>( | 192 | 704 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 704 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 0 | block.get_by_position(result).column = | 203 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 9 | } else { | 205 | 9 | block.get_by_position(result).column = std::move(col_to); | 206 | 9 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 3 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 3 | null_map_data = col_null_map_to->get_data().data(); | 180 | 3 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 623 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 614 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 614 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 614 | typename ToDataType::FieldType>( | 192 | 614 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 614 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 3 | block.get_by_position(result).column = | 203 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 6 | } else { | 205 | 6 | block.get_by_position(result).column = std::move(col_to); | 206 | 6 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 147 | 9 | const NullMap::value_type* null_map = nullptr) const override { | 148 | 9 | using ToFieldType = typename ToDataType::FieldType; | 149 | | | 150 | 9 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 151 | 9 | const auto* col_from = | 152 | 9 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 153 | 9 | if (!col_from) { | 154 | 0 | return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}", | 155 | 0 | type_to_string(FromDataType::PType), | 156 | 0 | named_from.column->get_name())); | 157 | 0 | } | 158 | 9 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 159 | 9 | UInt32 from_precision = from_decimal_type.get_precision(); | 160 | 9 | UInt32 from_scale = from_decimal_type.get_scale(); | 161 | | | 162 | | // may overflow if integer part of decimal is larger than to_max_digits | 163 | | // in strict mode we also decide nullable on this. | 164 | 9 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>(); | 165 | 9 | bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits; | 166 | | // only in non-strict mode and may overflow, we set nullable | 167 | 9 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable; | 168 | | | 169 | 9 | auto col_to = ToDataType::ColumnType::create(input_rows_count); | 170 | 9 | const auto& vec_from = col_from->get_data(); | 171 | 9 | const auto* vec_from_data = vec_from.data(); | 172 | 9 | auto& vec_to = col_to->get_data(); | 173 | 9 | auto* vec_to_data = vec_to.data(); | 174 | | | 175 | 9 | ColumnUInt8::MutablePtr col_null_map_to; | 176 | 9 | NullMap::value_type* null_map_data = nullptr; | 177 | 9 | if (overflow_and_nullable) { | 178 | 3 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 179 | 3 | null_map_data = col_null_map_to->get_data().data(); | 180 | 3 | } | 181 | | | 182 | 9 | CastParameters params; | 183 | 9 | params.is_strict = (CastMode == CastModeType::StrictMode); | 184 | 9 | size_t size = vec_from.size(); | 185 | 623 | for (size_t i = 0; i < size; i++) { | 186 | | // Skip hidden payload of rows marked as null by the input null map. | 187 | 614 | if (null_map && null_map[i]) { | 188 | 0 | continue; | 189 | 0 | } | 190 | 614 | if (!CastToInt::from_decimal<typename FromDataType::FieldType, | 191 | 614 | typename ToDataType::FieldType>( | 192 | 614 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], params)) { | 193 | 0 | if (set_nullable) { | 194 | 0 | null_map_data[i] = 1; | 195 | 0 | } else { | 196 | 0 | return params.status; | 197 | 0 | } | 198 | 0 | } | 199 | 614 | } | 200 | | | 201 | 9 | if (overflow_and_nullable) { | 202 | 3 | block.get_by_position(result).column = | 203 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 204 | 6 | } else { | 205 | 6 | block.get_by_position(result).column = std::move(col_to); | 206 | 6 | } | 207 | 9 | return Status::OK(); | 208 | 9 | } |
|
209 | | }; |
210 | | |
211 | | template <typename T> |
212 | | constexpr static bool int_allow_cast_from_date = |
213 | | std::is_same_v<T, DataTypeInt32> || std::is_same_v<T, DataTypeInt64> || |
214 | | std::is_same_v<T, DataTypeInt128>; |
215 | | |
216 | | template <typename T> |
217 | | constexpr static bool int_allow_cast_from_datetime = |
218 | | std::is_same_v<T, DataTypeInt64> || std::is_same_v<T, DataTypeInt128>; |
219 | | |
220 | | // cast from date and datetime to int |
221 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
222 | | requires(((IsDateType<FromDataType> || |
223 | | IsDateV2Type<FromDataType>)&&int_allow_cast_from_date<ToDataType>) || |
224 | | ((IsDateTimeType<FromDataType> || IsDateTimeV2Type<FromDataType> || |
225 | | std::is_same_v<FromDataType, |
226 | | DataTypeTimeStampNs>)&&int_allow_cast_from_datetime<ToDataType>)) |
227 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
228 | | public: |
229 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
230 | | uint32_t result, size_t input_rows_count, |
231 | 24 | const NullMap::value_type* null_map = nullptr) const override { |
232 | 24 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, |
233 | 24 | input_rows_count); |
234 | 24 | } Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_12DataTypeDateENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_12DataTypeDateENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 231 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 232 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 233 | 1 | input_rows_count); | 234 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 231 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 232 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 233 | 1 | input_rows_count); | 234 | 1 | } |
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_12DataTypeDateENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_12DataTypeDateENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 231 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 232 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 233 | 1 | input_rows_count); | 234 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 231 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 232 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 233 | 1 | input_rows_count); | 234 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_18DataTypeDateTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 231 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 232 | 4 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 233 | 4 | input_rows_count); | 234 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_18DataTypeDateTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 231 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 232 | 4 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 233 | 4 | input_rows_count); | 234 | 4 | } |
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_19DataTypeTimeStampNsENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_19DataTypeTimeStampNsENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 231 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 232 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 233 | 1 | input_rows_count); | 234 | 1 | } |
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_16DataTypeDateTimeENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_16DataTypeDateTimeENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_12DataTypeDateENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_12DataTypeDateENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 231 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 232 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 233 | 1 | input_rows_count); | 234 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 231 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 232 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 233 | 1 | input_rows_count); | 234 | 1 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_18DataTypeDateTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 231 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 232 | 4 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 233 | 4 | input_rows_count); | 234 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_18DataTypeDateTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 231 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 232 | 4 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 233 | 4 | input_rows_count); | 234 | 4 | } |
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_19DataTypeTimeStampNsENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_19DataTypeTimeStampNsENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 231 | 1 | const NullMap::value_type* null_map = nullptr) const override { | 232 | 1 | return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result, | 233 | 1 | input_rows_count); | 234 | 1 | } |
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_16DataTypeDateTimeENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_16DataTypeDateTimeENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh |
235 | | }; |
236 | | } // namespace doris |