Coverage Report

Created: 2026-07-27 20:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/function/cast/function_cast_ip.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
// This translation unit is the ONLY place that includes cast_to_ip.h.
19
// All CastToImpl<CastMode, From, ToIpType> template instantiations are
20
// confined here, keeping them out of function_cast.cpp.
21
22
#include "core/data_type/data_type_ipv4.h"
23
#include "core/data_type/data_type_ipv6.h"
24
#include "exprs/function/cast/cast_base.h"
25
#include "exprs/function/cast/cast_to_ip.h"
26
27
namespace doris::CastWrapper {
28
29
template <typename IpType>
30
    requires(std::is_same_v<IpType, DataTypeIPv4> || std::is_same_v<IpType, DataTypeIPv6>)
31
34
WrapperType create_ip_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
32
34
    std::shared_ptr<CastToBase> cast_to_ip;
33
34
34
    auto make_ip_wrapper = [&](const auto& types) -> bool {
35
34
        using Types = std::decay_t<decltype(types)>;
36
34
        using FromDataType = typename Types::LeftType;
37
        if constexpr (IsDataTypeNumber<FromDataType> || IsStringType<FromDataType> ||
38
34
                      IsIPType<FromDataType>) {
39
34
            if (context->enable_strict_mode()) {
40
24
                cast_to_ip = std::make_shared<
41
24
                        CastToImpl<CastModeType::StrictMode, FromDataType, IpType>>();
42
24
            } else {
43
10
                cast_to_ip = std::make_shared<
44
10
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, IpType>>();
45
10
            }
46
34
            return true;
47
34
        } else {
48
0
            return false;
49
0
        }
50
34
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairIS2_vEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairIS4_vEEEEbSR_
_ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSR_
Line
Count
Source
34
14
    auto make_ip_wrapper = [&](const auto& types) -> bool {
35
14
        using Types = std::decay_t<decltype(types)>;
36
14
        using FromDataType = typename Types::LeftType;
37
        if constexpr (IsDataTypeNumber<FromDataType> || IsStringType<FromDataType> ||
38
14
                      IsIPType<FromDataType>) {
39
14
            if (context->enable_strict_mode()) {
40
10
                cast_to_ip = std::make_shared<
41
10
                        CastToImpl<CastModeType::StrictMode, FromDataType, IpType>>();
42
10
            } else {
43
4
                cast_to_ip = std::make_shared<
44
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, IpType>>();
45
4
            }
46
14
            return true;
47
        } else {
48
            return false;
49
        }
50
14
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSR_
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSR_
_ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairIS4_vEEEEbSR_
Line
Count
Source
34
2
    auto make_ip_wrapper = [&](const auto& types) -> bool {
35
2
        using Types = std::decay_t<decltype(types)>;
36
2
        using FromDataType = typename Types::LeftType;
37
        if constexpr (IsDataTypeNumber<FromDataType> || IsStringType<FromDataType> ||
38
2
                      IsIPType<FromDataType>) {
39
2
            if (context->enable_strict_mode()) {
40
0
                cast_to_ip = std::make_shared<
41
0
                        CastToImpl<CastModeType::StrictMode, FromDataType, IpType>>();
42
2
            } else {
43
2
                cast_to_ip = std::make_shared<
44
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, IpType>>();
45
2
            }
46
2
            return true;
47
        } else {
48
            return false;
49
        }
50
2
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairIS2_vEEEEbSR_
_ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKS3_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSR_
Line
Count
Source
34
18
    auto make_ip_wrapper = [&](const auto& types) -> bool {
35
18
        using Types = std::decay_t<decltype(types)>;
36
18
        using FromDataType = typename Types::LeftType;
37
        if constexpr (IsDataTypeNumber<FromDataType> || IsStringType<FromDataType> ||
38
18
                      IsIPType<FromDataType>) {
39
18
            if (context->enable_strict_mode()) {
40
14
                cast_to_ip = std::make_shared<
41
14
                        CastToImpl<CastModeType::StrictMode, FromDataType, IpType>>();
42
14
            } else {
43
4
                cast_to_ip = std::make_shared<
44
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, IpType>>();
45
4
            }
46
18
            return true;
47
        } else {
48
            return false;
49
        }
50
18
    };
51
52
34
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_ip_wrapper)) {
53
0
        return create_unsupport_wrapper(
54
0
                fmt::format("CAST AS ip not supported {}", from_type->get_name()));
55
0
    }
56
57
34
    return [cast_to_ip](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
58
34
                        uint32_t result, size_t input_rows_count,
59
34
                        const NullMap::value_type* null_map = nullptr) {
60
34
        return cast_to_ip->execute_impl(context, block, arguments, result, input_rows_count,
61
34
                                        null_map);
62
34
    };
_ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_
Line
Count
Source
59
14
                        const NullMap::value_type* null_map = nullptr) {
60
14
        return cast_to_ip->execute_impl(context, block, arguments, result, input_rows_count,
61
14
                                        null_map);
62
14
    };
_ZZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_
Line
Count
Source
59
20
                        const NullMap::value_type* null_map = nullptr) {
60
20
        return cast_to_ip->execute_impl(context, block, arguments, result, input_rows_count,
61
20
                                        null_map);
62
20
    };
63
34
}
_ZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv4EQoosr3stdE9is_same_vIT_S2_Esr3stdE9is_same_vIS3_NS_12DataTypeIPv6EEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE
Line
Count
Source
31
14
WrapperType create_ip_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
32
14
    std::shared_ptr<CastToBase> cast_to_ip;
33
34
14
    auto make_ip_wrapper = [&](const auto& types) -> bool {
35
14
        using Types = std::decay_t<decltype(types)>;
36
14
        using FromDataType = typename Types::LeftType;
37
14
        if constexpr (IsDataTypeNumber<FromDataType> || IsStringType<FromDataType> ||
38
14
                      IsIPType<FromDataType>) {
39
14
            if (context->enable_strict_mode()) {
40
14
                cast_to_ip = std::make_shared<
41
14
                        CastToImpl<CastModeType::StrictMode, FromDataType, IpType>>();
42
14
            } else {
43
14
                cast_to_ip = std::make_shared<
44
14
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, IpType>>();
45
14
            }
46
14
            return true;
47
14
        } else {
48
14
            return false;
49
14
        }
50
14
    };
51
52
14
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_ip_wrapper)) {
53
0
        return create_unsupport_wrapper(
54
0
                fmt::format("CAST AS ip not supported {}", from_type->get_name()));
55
0
    }
56
57
14
    return [cast_to_ip](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
58
14
                        uint32_t result, size_t input_rows_count,
59
14
                        const NullMap::value_type* null_map = nullptr) {
60
14
        return cast_to_ip->execute_impl(context, block, arguments, result, input_rows_count,
61
14
                                        null_map);
62
14
    };
63
14
}
_ZN5doris11CastWrapper17create_ip_wrapperINS_12DataTypeIPv6EQoosr3stdE9is_same_vIT_NS_12DataTypeIPv4EEsr3stdE9is_same_vIS3_S2_EEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE
Line
Count
Source
31
20
WrapperType create_ip_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
32
20
    std::shared_ptr<CastToBase> cast_to_ip;
33
34
20
    auto make_ip_wrapper = [&](const auto& types) -> bool {
35
20
        using Types = std::decay_t<decltype(types)>;
36
20
        using FromDataType = typename Types::LeftType;
37
20
        if constexpr (IsDataTypeNumber<FromDataType> || IsStringType<FromDataType> ||
38
20
                      IsIPType<FromDataType>) {
39
20
            if (context->enable_strict_mode()) {
40
20
                cast_to_ip = std::make_shared<
41
20
                        CastToImpl<CastModeType::StrictMode, FromDataType, IpType>>();
42
20
            } else {
43
20
                cast_to_ip = std::make_shared<
44
20
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, IpType>>();
45
20
            }
46
20
            return true;
47
20
        } else {
48
20
            return false;
49
20
        }
50
20
    };
51
52
20
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_ip_wrapper)) {
53
0
        return create_unsupport_wrapper(
54
0
                fmt::format("CAST AS ip not supported {}", from_type->get_name()));
55
0
    }
56
57
20
    return [cast_to_ip](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
58
20
                        uint32_t result, size_t input_rows_count,
59
20
                        const NullMap::value_type* null_map = nullptr) {
60
20
        return cast_to_ip->execute_impl(context, block, arguments, result, input_rows_count,
61
20
                                        null_map);
62
20
    };
63
20
}
64
65
WrapperType create_ip_wrapper(FunctionContext* context, const DataTypePtr& from_type,
66
34
                              PrimitiveType to_type) {
67
34
    switch (to_type) {
68
14
    case TYPE_IPV4:
69
14
        return create_ip_wrapper<DataTypeIPv4>(context, from_type);
70
20
    case TYPE_IPV6:
71
20
        return create_ip_wrapper<DataTypeIPv6>(context, from_type);
72
0
    default:
73
0
        return create_unsupport_wrapper(
74
0
                fmt::format("CAST AS ip: unsupported to_type {}", type_to_string(to_type)));
75
34
    }
76
34
}
77
78
} // namespace doris::CastWrapper