be/src/exprs/function/cast/function_cast_timestamptz.cpp
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 | | #include "exprs/function/cast/cast_to_timestamptz.h" |
19 | | |
20 | | namespace doris::CastWrapper { |
21 | 0 | WrapperType create_timestamptz_wrapper(FunctionContext* context, const DataTypePtr& from_type) { |
22 | 0 | std::shared_ptr<CastToBase> cast_to_timestamptz; |
23 | |
|
24 | 0 | auto make_timestamptz_wrapper = [&](const auto& types) -> bool { |
25 | 0 | using Types = std::decay_t<decltype(types)>; |
26 | 0 | using FromDataType = typename Types::LeftType; |
27 | | if constexpr (CastUtil::IsBaseCastFromType<FromDataType> || |
28 | 0 | IsTimeStampTzType<FromDataType>) { |
29 | 0 | if (context->enable_strict_mode()) { |
30 | 0 | cast_to_timestamptz = std::make_shared< |
31 | 0 | CastToImpl<CastModeType::StrictMode, FromDataType, DataTypeTimeStampTz>>(); |
32 | 0 | } else { |
33 | 0 | cast_to_timestamptz = |
34 | 0 | std::make_shared<CastToImpl<CastModeType::NonStrictMode, FromDataType, |
35 | 0 | DataTypeTimeStampTz>>(); |
36 | 0 | } |
37 | 0 | return true; |
38 | | } else { |
39 | | return false; |
40 | | } |
41 | 0 | }; Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_ Unexecuted instantiation: function_cast_timestamptz.cpp:_ZZN5doris11CastWrapper26create_timestamptz_wrapperEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEEENK3$_1clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_ |
42 | |
|
43 | 0 | if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), |
44 | 0 | make_timestamptz_wrapper)) { |
45 | 0 | return create_unsupport_wrapper( |
46 | 0 | fmt::format("CAST AS timestamptz not supported {}", from_type->get_name())); |
47 | 0 | } |
48 | | |
49 | 0 | return [cast_to_timestamptz](FunctionContext* context, Block& block, |
50 | 0 | const ColumnNumbers& arguments, uint32_t result, |
51 | 0 | size_t input_rows_count, |
52 | 0 | const NullMap::value_type* null_map = nullptr) { |
53 | 0 | return cast_to_timestamptz->execute_impl(context, block, arguments, result, |
54 | 0 | input_rows_count, null_map); |
55 | 0 | }; |
56 | 0 | } |
57 | | } // namespace doris::CastWrapper |