Coverage Report

Created: 2026-03-14 20:54

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
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
#include "common/compile_check_begin.h"
30
31
// Types that can be cast to int: string, bool, int, float, double, decimal, date, datetime and time.
32
// It's not supported to cast date to tinyint and smallint, because it will definitely overflow.
33
// It's not supported to cast datetime to tinyint and smallint, because it will definitely overflow.
34
// Casting from string and decimal types are handled in `cast_to_basic_number_common.h`.
35
36
// may overflow if:
37
// 1. from wider int to narrower int
38
// 2. from float/double to int
39
// 3. from time to tinyint, smallint and int
40
template <typename FromDataType, typename ToDataType>
41
constexpr bool CastToIntMayOverflow =
42
        (IsDataTypeInt<FromDataType> &&
43
         sizeof(typename FromDataType::FieldType) > sizeof(typename ToDataType::FieldType)) ||
44
        IsDataTypeFloat<FromDataType> ||
45
        (std::is_same_v<FromDataType, DataTypeTimeV2> &&
46
         (std::is_same_v<ToDataType, DataTypeInt32> || std::is_same_v<ToDataType, DataTypeInt16> ||
47
          std::is_same_v<ToDataType, DataTypeInt8>));
48
49
// from number types and timev2 type to integer types which this cast may overflow -> result type is always nullable.
50
template <CastModeType CastMode, typename FromDataType, typename ToDataType>
51
    requires(IsDataTypeInt<ToDataType> &&
52
             (IsDataTypeNumber<FromDataType> || std::is_same_v<FromDataType, DataTypeTimeV2>) &&
53
             CastToIntMayOverflow<FromDataType, ToDataType>)
54
class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase {
55
public:
56
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
57
                        uint32_t result, size_t input_rows_count,
58
1.17k
                        const NullMap::value_type* null_map = nullptr) const override {
59
1.17k
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
1.17k
                block.get_by_position(arguments[0]).column.get());
61
1.17k
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
1.17k
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
674
        const auto& vec_from = col_from->get_data();
69
674
        auto& vec_to = col_to->get_data();
70
674
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
674
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
674
        CastParameters params;
74
674
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
3.93k
        for (size_t i = 0; i < input_rows_count; ++i) {
76
2.11k
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
260
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
40
                        vec_null_map_to[i] = 1;
82
40
                        continue;
83
40
                    } else {
84
40
                        return params.status;
85
40
                    }
86
80
                }
87
896
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
896
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
312
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
156
                        vec_null_map_to[i] = 1;
91
156
                        continue;
92
156
                    } else {
93
156
                        return params.status;
94
156
                    }
95
312
                }
96
960
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
960
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
904
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
452
                        vec_null_map_to[i] = 1;
100
452
                        continue;
101
452
                    } else {
102
452
                        return params.status;
103
452
                    }
104
904
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
2.11k
        }
111
1.14k
        block.get_by_position(result).column =
112
1.14k
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
1.14k
        return Status::OK();
115
498
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
5
                        const NullMap::value_type* null_map = nullptr) const override {
59
5
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
5
                block.get_by_position(arguments[0]).column.get());
61
5
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
5
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
5
        const auto& vec_from = col_from->get_data();
69
5
        auto& vec_to = col_to->get_data();
70
5
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
5
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
5
        CastParameters params;
74
5
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
18
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
4
                    } else {
84
4
                        return params.status;
85
4
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
5
        block.get_by_position(result).column =
112
5
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
5
        return Status::OK();
115
5
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
19
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
4
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
4
                        vec_null_map_to[i] = 1;
82
4
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
6
        block.get_by_position(result).column =
112
6
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
6
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
5
                        const NullMap::value_type* null_map = nullptr) const override {
59
5
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
5
                block.get_by_position(arguments[0]).column.get());
61
5
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
5
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
5
        const auto& vec_from = col_from->get_data();
69
5
        auto& vec_to = col_to->get_data();
70
5
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
5
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
5
        CastParameters params;
74
5
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
18
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
4
                    } else {
84
4
                        return params.status;
85
4
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
5
        block.get_by_position(result).column =
112
5
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
5
        return Status::OK();
115
5
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
19
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
4
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
4
                        vec_null_map_to[i] = 1;
82
4
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
6
        block.get_by_position(result).column =
112
6
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
6
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
5
                        const NullMap::value_type* null_map = nullptr) const override {
59
5
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
5
                block.get_by_position(arguments[0]).column.get());
61
5
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
5
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
5
        const auto& vec_from = col_from->get_data();
69
5
        auto& vec_to = col_to->get_data();
70
5
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
5
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
5
        CastParameters params;
74
5
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
18
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
4
                    } else {
84
4
                        return params.status;
85
4
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
5
        block.get_by_position(result).column =
112
5
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
5
        return Status::OK();
115
5
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
19
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
4
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
4
                        vec_null_map_to[i] = 1;
82
4
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
6
        block.get_by_position(result).column =
112
6
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
6
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
5
                        const NullMap::value_type* null_map = nullptr) const override {
59
5
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
5
                block.get_by_position(arguments[0]).column.get());
61
5
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
5
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
5
        const auto& vec_from = col_from->get_data();
69
5
        auto& vec_to = col_to->get_data();
70
5
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
5
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
5
        CastParameters params;
74
5
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
18
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
4
                    } else {
84
4
                        return params.status;
85
4
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
5
        block.get_by_position(result).column =
112
5
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
5
        return Status::OK();
115
5
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
19
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
4
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
4
                        vec_null_map_to[i] = 1;
82
4
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
6
        block.get_by_position(result).column =
112
6
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
6
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
21
                        const NullMap::value_type* null_map = nullptr) const override {
59
21
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
21
                block.get_by_position(arguments[0]).column.get());
61
21
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
21
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
21
        const auto& vec_from = col_from->get_data();
69
21
        auto& vec_to = col_to->get_data();
70
21
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
21
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
21
        CastParameters params;
74
21
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
59
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
38
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
38
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
20
                    } else {
93
20
                        return params.status;
94
20
                    }
95
20
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
38
        }
111
21
        block.get_by_position(result).column =
112
21
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
21
        return Status::OK();
115
21
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
60
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
38
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
38
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
20
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
20
                        vec_null_map_to[i] = 1;
91
20
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
20
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
38
        }
111
22
        block.get_by_position(result).column =
112
22
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
22
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
25
                        const NullMap::value_type* null_map = nullptr) const override {
59
25
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
25
                block.get_by_position(arguments[0]).column.get());
61
25
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
25
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
25
        const auto& vec_from = col_from->get_data();
69
25
        auto& vec_to = col_to->get_data();
70
25
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
25
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
25
        CastParameters params;
74
25
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
67
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
42
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
42
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
24
                    } else {
93
24
                        return params.status;
94
24
                    }
95
24
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
42
        }
111
25
        block.get_by_position(result).column =
112
25
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
25
        return Status::OK();
115
25
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
68
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
42
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
42
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
24
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
24
                        vec_null_map_to[i] = 1;
91
24
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
24
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
42
        }
111
26
        block.get_by_position(result).column =
112
26
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
26
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
160
                        const NullMap::value_type* null_map = nullptr) const override {
59
160
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
160
                block.get_by_position(arguments[0]).column.get());
61
160
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
160
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
160
        const auto& vec_from = col_from->get_data();
69
160
        auto& vec_to = col_to->get_data();
70
160
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
160
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
160
        CastParameters params;
74
160
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
320
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
160
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
160
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
158
                    } else {
102
158
                        return params.status;
103
158
                    }
104
158
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
160
        }
111
160
        block.get_by_position(result).column =
112
160
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
160
        return Status::OK();
115
160
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
160
                        const NullMap::value_type* null_map = nullptr) const override {
59
160
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
160
                block.get_by_position(arguments[0]).column.get());
61
160
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
160
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
160
        const auto& vec_from = col_from->get_data();
69
160
        auto& vec_to = col_to->get_data();
70
160
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
160
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
160
        CastParameters params;
74
160
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
478
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
160
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
160
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
158
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
158
                        vec_null_map_to[i] = 1;
100
158
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
158
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
160
        }
111
318
        block.get_by_position(result).column =
112
318
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
318
        return Status::OK();
115
160
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
5
                        const NullMap::value_type* null_map = nullptr) const override {
59
5
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
5
                block.get_by_position(arguments[0]).column.get());
61
5
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
5
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
5
        const auto& vec_from = col_from->get_data();
69
5
        auto& vec_to = col_to->get_data();
70
5
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
5
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
5
        CastParameters params;
74
5
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
18
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
4
                    } else {
84
4
                        return params.status;
85
4
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
5
        block.get_by_position(result).column =
112
5
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
5
        return Status::OK();
115
5
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
19
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
4
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
4
                        vec_null_map_to[i] = 1;
82
4
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
6
        block.get_by_position(result).column =
112
6
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
6
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
5
                        const NullMap::value_type* null_map = nullptr) const override {
59
5
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
5
                block.get_by_position(arguments[0]).column.get());
61
5
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
5
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
5
        const auto& vec_from = col_from->get_data();
69
5
        auto& vec_to = col_to->get_data();
70
5
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
5
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
5
        CastParameters params;
74
5
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
18
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
4
                    } else {
84
4
                        return params.status;
85
4
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
5
        block.get_by_position(result).column =
112
5
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
5
        return Status::OK();
115
5
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
19
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
4
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
4
                        vec_null_map_to[i] = 1;
82
4
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
6
        block.get_by_position(result).column =
112
6
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
6
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
5
                        const NullMap::value_type* null_map = nullptr) const override {
59
5
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
5
                block.get_by_position(arguments[0]).column.get());
61
5
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
5
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
5
        const auto& vec_from = col_from->get_data();
69
5
        auto& vec_to = col_to->get_data();
70
5
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
5
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
5
        CastParameters params;
74
5
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
18
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
4
                    } else {
84
4
                        return params.status;
85
4
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
5
        block.get_by_position(result).column =
112
5
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
5
        return Status::OK();
115
5
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
19
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
4
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
4
                        vec_null_map_to[i] = 1;
82
4
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
6
        block.get_by_position(result).column =
112
6
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
6
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
19
                        const NullMap::value_type* null_map = nullptr) const override {
59
19
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
19
                block.get_by_position(arguments[0]).column.get());
61
19
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
19
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
19
        const auto& vec_from = col_from->get_data();
69
19
        auto& vec_to = col_to->get_data();
70
19
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
19
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
19
        CastParameters params;
74
19
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
59
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
40
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
40
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
18
                    } else {
93
18
                        return params.status;
94
18
                    }
95
18
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
40
        }
111
19
        block.get_by_position(result).column =
112
19
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
19
        return Status::OK();
115
19
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
60
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
40
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
40
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
18
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
18
                        vec_null_map_to[i] = 1;
91
18
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
18
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
40
        }
111
20
        block.get_by_position(result).column =
112
20
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
20
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
23
                        const NullMap::value_type* null_map = nullptr) const override {
59
23
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
23
                block.get_by_position(arguments[0]).column.get());
61
23
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
23
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
23
        const auto& vec_from = col_from->get_data();
69
23
        auto& vec_to = col_to->get_data();
70
23
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
23
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
23
        CastParameters params;
74
23
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
67
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
44
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
44
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
22
                    } else {
93
22
                        return params.status;
94
22
                    }
95
22
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
44
        }
111
23
        block.get_by_position(result).column =
112
23
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
23
        return Status::OK();
115
23
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
68
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
44
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
44
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
22
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
22
                        vec_null_map_to[i] = 1;
91
22
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
22
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
44
        }
111
24
        block.get_by_position(result).column =
112
24
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
24
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
160
                        const NullMap::value_type* null_map = nullptr) const override {
59
160
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
160
                block.get_by_position(arguments[0]).column.get());
61
160
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
160
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
160
        const auto& vec_from = col_from->get_data();
69
160
        auto& vec_to = col_to->get_data();
70
160
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
160
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
160
        CastParameters params;
74
160
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
320
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
160
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
160
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
158
                    } else {
102
158
                        return params.status;
103
158
                    }
104
158
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
160
        }
111
160
        block.get_by_position(result).column =
112
160
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
160
        return Status::OK();
115
160
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
160
                        const NullMap::value_type* null_map = nullptr) const override {
59
160
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
160
                block.get_by_position(arguments[0]).column.get());
61
160
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
160
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
160
        const auto& vec_from = col_from->get_data();
69
160
        auto& vec_to = col_to->get_data();
70
160
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
160
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
160
        CastParameters params;
74
160
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
478
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
160
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
160
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
158
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
158
                        vec_null_map_to[i] = 1;
100
158
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
158
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
160
        }
111
318
        block.get_by_position(result).column =
112
318
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
318
        return Status::OK();
115
160
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
5
                        const NullMap::value_type* null_map = nullptr) const override {
59
5
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
5
                block.get_by_position(arguments[0]).column.get());
61
5
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
5
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
5
        const auto& vec_from = col_from->get_data();
69
5
        auto& vec_to = col_to->get_data();
70
5
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
5
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
5
        CastParameters params;
74
5
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
18
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
4
                    } else {
84
4
                        return params.status;
85
4
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
5
        block.get_by_position(result).column =
112
5
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
5
        return Status::OK();
115
5
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
19
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
4
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
4
                        vec_null_map_to[i] = 1;
82
4
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
6
        block.get_by_position(result).column =
112
6
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
6
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
5
                        const NullMap::value_type* null_map = nullptr) const override {
59
5
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
5
                block.get_by_position(arguments[0]).column.get());
61
5
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
5
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
5
        const auto& vec_from = col_from->get_data();
69
5
        auto& vec_to = col_to->get_data();
70
5
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
5
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
5
        CastParameters params;
74
5
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
18
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
4
                    } else {
84
4
                        return params.status;
85
4
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
5
        block.get_by_position(result).column =
112
5
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
5
        return Status::OK();
115
5
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
19
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
4
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
4
                        vec_null_map_to[i] = 1;
82
4
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
6
        block.get_by_position(result).column =
112
6
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
6
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
15
                        const NullMap::value_type* null_map = nullptr) const override {
59
15
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
15
                block.get_by_position(arguments[0]).column.get());
61
15
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
15
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
15
        const auto& vec_from = col_from->get_data();
69
15
        auto& vec_to = col_to->get_data();
70
15
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
15
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
15
        CastParameters params;
74
15
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
59
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
44
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
44
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
14
                    } else {
93
14
                        return params.status;
94
14
                    }
95
14
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
44
        }
111
15
        block.get_by_position(result).column =
112
15
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
15
        return Status::OK();
115
15
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
60
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
44
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
44
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
14
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
14
                        vec_null_map_to[i] = 1;
91
14
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
14
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
44
        }
111
16
        block.get_by_position(result).column =
112
16
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
16
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
19
                        const NullMap::value_type* null_map = nullptr) const override {
59
19
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
19
                block.get_by_position(arguments[0]).column.get());
61
19
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
19
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
19
        const auto& vec_from = col_from->get_data();
69
19
        auto& vec_to = col_to->get_data();
70
19
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
19
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
19
        CastParameters params;
74
19
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
67
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
48
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
48
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
18
                    } else {
93
18
                        return params.status;
94
18
                    }
95
18
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
48
        }
111
19
        block.get_by_position(result).column =
112
19
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
19
        return Status::OK();
115
19
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
68
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
48
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
48
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
18
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
18
                        vec_null_map_to[i] = 1;
91
18
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
18
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
48
        }
111
20
        block.get_by_position(result).column =
112
20
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
20
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
138
                        const NullMap::value_type* null_map = nullptr) const override {
59
138
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
138
                block.get_by_position(arguments[0]).column.get());
61
138
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
138
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
138
        const auto& vec_from = col_from->get_data();
69
138
        auto& vec_to = col_to->get_data();
70
138
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
138
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
138
        CastParameters params;
74
138
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
298
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
160
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
160
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
136
                    } else {
102
136
                        return params.status;
103
136
                    }
104
136
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
160
        }
111
138
        block.get_by_position(result).column =
112
138
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
138
        return Status::OK();
115
138
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
138
                        const NullMap::value_type* null_map = nullptr) const override {
59
138
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
138
                block.get_by_position(arguments[0]).column.get());
61
138
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
138
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
138
        const auto& vec_from = col_from->get_data();
69
138
        auto& vec_to = col_to->get_data();
70
138
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
138
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
138
        CastParameters params;
74
138
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
434
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
160
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
160
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
136
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
136
                        vec_null_map_to[i] = 1;
100
136
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
136
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
160
        }
111
274
        block.get_by_position(result).column =
112
274
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
274
        return Status::OK();
115
138
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
5
                        const NullMap::value_type* null_map = nullptr) const override {
59
5
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
5
                block.get_by_position(arguments[0]).column.get());
61
5
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
5
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
5
        const auto& vec_from = col_from->get_data();
69
5
        auto& vec_to = col_to->get_data();
70
5
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
5
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
5
        CastParameters params;
74
5
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
18
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
4
                    } else {
84
4
                        return params.status;
85
4
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
5
        block.get_by_position(result).column =
112
5
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
5
        return Status::OK();
115
5
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
19
        for (size_t i = 0; i < input_rows_count; ++i) {
76
13
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
13
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
4
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
4
                        vec_null_map_to[i] = 1;
82
4
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
4
                }
87
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
13
        }
111
6
        block.get_by_position(result).column =
112
6
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
6
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
11
                        const NullMap::value_type* null_map = nullptr) const override {
59
11
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
11
                block.get_by_position(arguments[0]).column.get());
61
11
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
11
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
11
        const auto& vec_from = col_from->get_data();
69
11
        auto& vec_to = col_to->get_data();
70
11
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
11
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
11
        CastParameters params;
74
11
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
57
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
46
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
46
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
10
                    } else {
93
10
                        return params.status;
94
10
                    }
95
10
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
46
        }
111
11
        block.get_by_position(result).column =
112
11
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
11
        return Status::OK();
115
11
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
58
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
46
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
46
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
10
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
10
                        vec_null_map_to[i] = 1;
91
10
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
10
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
46
        }
111
12
        block.get_by_position(result).column =
112
12
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
12
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
15
                        const NullMap::value_type* null_map = nullptr) const override {
59
15
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
15
                block.get_by_position(arguments[0]).column.get());
61
15
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
15
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
15
        const auto& vec_from = col_from->get_data();
69
15
        auto& vec_to = col_to->get_data();
70
15
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
15
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
15
        CastParameters params;
74
15
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
65
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
50
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
50
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
14
                    } else {
93
14
                        return params.status;
94
14
                    }
95
14
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
50
        }
111
15
        block.get_by_position(result).column =
112
15
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
15
        return Status::OK();
115
15
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
66
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
50
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
50
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
14
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
14
                        vec_null_map_to[i] = 1;
91
14
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
14
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
50
        }
111
16
        block.get_by_position(result).column =
112
16
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
16
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
7
                        const NullMap::value_type* null_map = nullptr) const override {
59
7
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
7
                block.get_by_position(arguments[0]).column.get());
61
7
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
7
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
7
        const auto& vec_from = col_from->get_data();
69
7
        auto& vec_to = col_to->get_data();
70
7
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
7
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
7
        CastParameters params;
74
7
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
53
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
46
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
46
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
6
                    } else {
93
6
                        return params.status;
94
6
                    }
95
6
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
46
        }
111
7
        block.get_by_position(result).column =
112
7
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
7
        return Status::OK();
115
7
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
54
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
46
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
46
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
6
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
6
                        vec_null_map_to[i] = 1;
91
6
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
6
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
46
        }
111
8
        block.get_by_position(result).column =
112
8
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
8
        return Status::OK();
115
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
11
                        const NullMap::value_type* null_map = nullptr) const override {
59
11
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
11
                block.get_by_position(arguments[0]).column.get());
61
11
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
11
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
11
        const auto& vec_from = col_from->get_data();
69
11
        auto& vec_to = col_to->get_data();
70
11
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
11
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
11
        CastParameters params;
74
11
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
61
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
50
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
50
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
                        vec_null_map_to[i] = 1;
91
                        continue;
92
10
                    } else {
93
10
                        return params.status;
94
10
                    }
95
10
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
50
        }
111
11
        block.get_by_position(result).column =
112
11
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
11
        return Status::OK();
115
11
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
58
2
                        const NullMap::value_type* null_map = nullptr) const override {
59
2
        const auto* col_from = check_and_get_column<typename FromDataType::ColumnType>(
60
2
                block.get_by_position(arguments[0]).column.get());
61
2
        if (!col_from) {
62
0
            return Status::InternalError(
63
0
                    fmt::format("Column type mismatch: expected {}, got {}",
64
0
                                type_to_string(FromDataType::PType),
65
0
                                block.get_by_position(arguments[0]).column->get_name()));
66
0
        }
67
2
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
68
2
        const auto& vec_from = col_from->get_data();
69
2
        auto& vec_to = col_to->get_data();
70
2
        ColumnBool::MutablePtr col_null_map_to = ColumnBool::create(input_rows_count, 0);
71
2
        NullMap::value_type* vec_null_map_to = col_null_map_to->get_data().data();
72
73
2
        CastParameters params;
74
2
        params.is_strict = (CastMode == CastModeType::StrictMode);
75
62
        for (size_t i = 0; i < input_rows_count; ++i) {
76
            if constexpr (IsDataTypeInt<FromDataType>) {
77
                // although always nullable output, but only set null when overflow in non-strict mode.
78
                // in strict mode, just raise error on overflow.
79
                if (!CastToInt::from_int(vec_from[i], vec_to[i], params)) {
80
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
81
                        vec_null_map_to[i] = 1;
82
                        continue;
83
                    } else {
84
                        return params.status;
85
                    }
86
                }
87
50
            } else if constexpr (IsDataTypeFloat<FromDataType>) {
88
50
                if (!CastToInt::from_float(vec_from[i], vec_to[i], params)) {
89
10
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
90
10
                        vec_null_map_to[i] = 1;
91
10
                        continue;
92
                    } else {
93
                        return params.status;
94
                    }
95
10
                }
96
            } else if constexpr (std::is_same_v<FromDataType, DataTypeTimeV2>) {
97
                if (!CastToInt::from_time(vec_from[i], vec_to[i], params)) {
98
                    if constexpr (CastMode == CastModeType::NonStrictMode) {
99
                        vec_null_map_to[i] = 1;
100
                        continue;
101
                    } else {
102
                        return params.status;
103
                    }
104
                }
105
            } else {
106
                return Status::InternalError(fmt::format("Unsupported cast from {} to {}",
107
                                                         type_to_string(FromDataType::PType),
108
                                                         type_to_string(ToDataType::PType)));
109
            }
110
50
        }
111
12
        block.get_by_position(result).column =
112
12
                ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
113
114
12
        return Status::OK();
115
2
    }
116
};
117
118
/// cast to int, will not overflow and no nullable output:
119
/// 1. from bool;
120
/// 2. from narrow int to wider int
121
/// 3. from time to bigint and largeint
122
template <CastModeType CastMode, typename FromDataType, typename ToDataType>
123
    requires(IsDataTypeInt<ToDataType> &&
124
             (IsDataTypeNumber<FromDataType> || std::is_same_v<FromDataType, DataTypeTimeV2>) &&
125
             !CastToIntMayOverflow<FromDataType, ToDataType>)
126
class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase {
127
public:
128
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
129
                        uint32_t result, size_t input_rows_count,
130
313
                        const NullMap::value_type* null_map = nullptr) const override {
131
313
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
313
                                                                 input_rows_count);
133
313
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
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
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
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
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
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
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
76
                        const NullMap::value_type* null_map = nullptr) const override {
131
76
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
76
                                                                 input_rows_count);
133
76
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
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
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
103
                        const NullMap::value_type* null_map = nullptr) const override {
131
103
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
103
                                                                 input_rows_count);
133
103
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
1
                        const NullMap::value_type* null_map = nullptr) const override {
131
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
1
                                                                 input_rows_count);
133
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS2_ILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
95
                        const NullMap::value_type* null_map = nullptr) const override {
131
95
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
95
                                                                 input_rows_count);
133
95
    }
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
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
130
2
                        const NullMap::value_type* null_map = nullptr) const override {
131
2
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
132
2
                                                                 input_rows_count);
133
2
    }
134
};
135
136
// cast decimal to integer. always use overflow check to decide nullable
137
template <CastModeType CastMode, typename FromDataType, typename ToDataType>
138
    requires(IsDataTypeInt<ToDataType> && IsDataTypeDecimal<FromDataType>)
139
class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase {
140
public:
141
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
142
                        uint32_t result, size_t input_rows_count,
143
380
                        const NullMap::value_type* null_map = nullptr) const override {
144
380
        using ToFieldType = typename ToDataType::FieldType;
145
380
        using FromFieldType = typename FromDataType::FieldType;
146
147
380
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
380
        const auto* col_from =
149
380
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
380
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
380
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
380
        UInt32 from_precision = from_decimal_type.get_precision();
157
380
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
380
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
380
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
380
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
380
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
380
        const auto& vec_from = col_from->get_data();
170
380
        const auto* vec_from_data = vec_from.data();
171
380
        auto& vec_to = col_to->get_data();
172
380
        auto* vec_to_data = vec_to.data();
173
174
380
        ColumnUInt8::MutablePtr col_null_map_to;
175
380
        NullMap::value_type* null_map_data = nullptr;
176
380
        if (overflow_and_nullable) {
177
146
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
146
            null_map_data = col_null_map_to->get_data().data();
179
146
        }
180
181
380
        CastParameters params;
182
380
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
380
        size_t size = vec_from.size();
184
380
        typename FromFieldType::NativeType scale_multiplier =
185
380
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
22.4k
        for (size_t i = 0; i < size; i++) {
187
22.1k
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
22.1k
                                          typename ToDataType::FieldType>(
189
22.1k
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
22.1k
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
22.1k
        }
198
199
380
        if (overflow_and_nullable) {
200
146
            block.get_by_position(result).column =
201
146
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
234
        } else {
203
234
            block.get_by_position(result).column = std::move(col_to);
204
234
        }
205
380
        return Status::OK();
206
380
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
7
                        const NullMap::value_type* null_map = nullptr) const override {
144
7
        using ToFieldType = typename ToDataType::FieldType;
145
7
        using FromFieldType = typename FromDataType::FieldType;
146
147
7
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
7
        const auto* col_from =
149
7
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
7
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
7
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
7
        UInt32 from_precision = from_decimal_type.get_precision();
157
7
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
7
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
7
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
7
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
7
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
7
        const auto& vec_from = col_from->get_data();
170
7
        const auto* vec_from_data = vec_from.data();
171
7
        auto& vec_to = col_to->get_data();
172
7
        auto* vec_to_data = vec_to.data();
173
174
7
        ColumnUInt8::MutablePtr col_null_map_to;
175
7
        NullMap::value_type* null_map_data = nullptr;
176
7
        if (overflow_and_nullable) {
177
3
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
3
            null_map_data = col_null_map_to->get_data().data();
179
3
        }
180
181
7
        CastParameters params;
182
7
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
7
        size_t size = vec_from.size();
184
7
        typename FromFieldType::NativeType scale_multiplier =
185
7
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
302
        for (size_t i = 0; i < size; i++) {
187
295
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
295
                                          typename ToDataType::FieldType>(
189
295
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
295
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
295
        }
198
199
7
        if (overflow_and_nullable) {
200
3
            block.get_by_position(result).column =
201
3
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
7
        return Status::OK();
206
7
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
7
                        const NullMap::value_type* null_map = nullptr) const override {
144
7
        using ToFieldType = typename ToDataType::FieldType;
145
7
        using FromFieldType = typename FromDataType::FieldType;
146
147
7
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
7
        const auto* col_from =
149
7
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
7
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
7
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
7
        UInt32 from_precision = from_decimal_type.get_precision();
157
7
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
7
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
7
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
7
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
7
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
7
        const auto& vec_from = col_from->get_data();
170
7
        const auto* vec_from_data = vec_from.data();
171
7
        auto& vec_to = col_to->get_data();
172
7
        auto* vec_to_data = vec_to.data();
173
174
7
        ColumnUInt8::MutablePtr col_null_map_to;
175
7
        NullMap::value_type* null_map_data = nullptr;
176
7
        if (overflow_and_nullable) {
177
3
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
3
            null_map_data = col_null_map_to->get_data().data();
179
3
        }
180
181
7
        CastParameters params;
182
7
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
7
        size_t size = vec_from.size();
184
7
        typename FromFieldType::NativeType scale_multiplier =
185
7
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
302
        for (size_t i = 0; i < size; i++) {
187
295
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
295
                                          typename ToDataType::FieldType>(
189
295
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
295
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
295
        }
198
199
7
        if (overflow_and_nullable) {
200
3
            block.get_by_position(result).column =
201
3
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
7
        return Status::OK();
206
7
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
4
                        const NullMap::value_type* null_map = nullptr) const override {
144
4
        using ToFieldType = typename ToDataType::FieldType;
145
4
        using FromFieldType = typename FromDataType::FieldType;
146
147
4
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
4
        const auto* col_from =
149
4
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
4
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
4
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
4
        UInt32 from_precision = from_decimal_type.get_precision();
157
4
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
4
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
4
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
4
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
4
        const auto& vec_from = col_from->get_data();
170
4
        const auto* vec_from_data = vec_from.data();
171
4
        auto& vec_to = col_to->get_data();
172
4
        auto* vec_to_data = vec_to.data();
173
174
4
        ColumnUInt8::MutablePtr col_null_map_to;
175
4
        NullMap::value_type* null_map_data = nullptr;
176
4
        if (overflow_and_nullable) {
177
4
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
4
            null_map_data = col_null_map_to->get_data().data();
179
4
        }
180
181
4
        CastParameters params;
182
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
4
        size_t size = vec_from.size();
184
4
        typename FromFieldType::NativeType scale_multiplier =
185
4
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
148
        for (size_t i = 0; i < size; i++) {
187
144
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
144
                                          typename ToDataType::FieldType>(
189
144
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
144
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
144
        }
198
199
4
        if (overflow_and_nullable) {
200
4
            block.get_by_position(result).column =
201
4
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
0
            block.get_by_position(result).column = std::move(col_to);
204
0
        }
205
4
        return Status::OK();
206
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
4
                        const NullMap::value_type* null_map = nullptr) const override {
144
4
        using ToFieldType = typename ToDataType::FieldType;
145
4
        using FromFieldType = typename FromDataType::FieldType;
146
147
4
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
4
        const auto* col_from =
149
4
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
4
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
4
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
4
        UInt32 from_precision = from_decimal_type.get_precision();
157
4
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
4
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
4
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
4
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
4
        const auto& vec_from = col_from->get_data();
170
4
        const auto* vec_from_data = vec_from.data();
171
4
        auto& vec_to = col_to->get_data();
172
4
        auto* vec_to_data = vec_to.data();
173
174
4
        ColumnUInt8::MutablePtr col_null_map_to;
175
4
        NullMap::value_type* null_map_data = nullptr;
176
4
        if (overflow_and_nullable) {
177
4
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
4
            null_map_data = col_null_map_to->get_data().data();
179
4
        }
180
181
4
        CastParameters params;
182
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
4
        size_t size = vec_from.size();
184
4
        typename FromFieldType::NativeType scale_multiplier =
185
4
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
148
        for (size_t i = 0; i < size; i++) {
187
144
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
144
                                          typename ToDataType::FieldType>(
189
144
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
144
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
144
        }
198
199
4
        if (overflow_and_nullable) {
200
4
            block.get_by_position(result).column =
201
4
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
0
            block.get_by_position(result).column = std::move(col_to);
204
0
        }
205
4
        return Status::OK();
206
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_3EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
7
                        const NullMap::value_type* null_map = nullptr) const override {
144
7
        using ToFieldType = typename ToDataType::FieldType;
145
7
        using FromFieldType = typename FromDataType::FieldType;
146
147
7
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
7
        const auto* col_from =
149
7
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
7
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
7
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
7
        UInt32 from_precision = from_decimal_type.get_precision();
157
7
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
7
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
7
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
7
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
7
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
7
        const auto& vec_from = col_from->get_data();
170
7
        const auto* vec_from_data = vec_from.data();
171
7
        auto& vec_to = col_to->get_data();
172
7
        auto* vec_to_data = vec_to.data();
173
174
7
        ColumnUInt8::MutablePtr col_null_map_to;
175
7
        NullMap::value_type* null_map_data = nullptr;
176
7
        if (overflow_and_nullable) {
177
3
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
3
            null_map_data = col_null_map_to->get_data().data();
179
3
        }
180
181
7
        CastParameters params;
182
7
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
7
        size_t size = vec_from.size();
184
7
        typename FromFieldType::NativeType scale_multiplier =
185
7
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
302
        for (size_t i = 0; i < size; i++) {
187
295
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
295
                                          typename ToDataType::FieldType>(
189
295
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
295
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
295
        }
198
199
7
        if (overflow_and_nullable) {
200
3
            block.get_by_position(result).column =
201
3
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
7
        return Status::OK();
206
7
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
7
                        const NullMap::value_type* null_map = nullptr) const override {
144
7
        using ToFieldType = typename ToDataType::FieldType;
145
7
        using FromFieldType = typename FromDataType::FieldType;
146
147
7
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
7
        const auto* col_from =
149
7
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
7
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
7
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
7
        UInt32 from_precision = from_decimal_type.get_precision();
157
7
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
7
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
7
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
7
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
7
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
7
        const auto& vec_from = col_from->get_data();
170
7
        const auto* vec_from_data = vec_from.data();
171
7
        auto& vec_to = col_to->get_data();
172
7
        auto* vec_to_data = vec_to.data();
173
174
7
        ColumnUInt8::MutablePtr col_null_map_to;
175
7
        NullMap::value_type* null_map_data = nullptr;
176
7
        if (overflow_and_nullable) {
177
3
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
3
            null_map_data = col_null_map_to->get_data().data();
179
3
        }
180
181
7
        CastParameters params;
182
7
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
7
        size_t size = vec_from.size();
184
7
        typename FromFieldType::NativeType scale_multiplier =
185
7
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
302
        for (size_t i = 0; i < size; i++) {
187
295
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
295
                                          typename ToDataType::FieldType>(
189
295
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
295
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
295
        }
198
199
7
        if (overflow_and_nullable) {
200
3
            block.get_by_position(result).column =
201
3
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
7
        return Status::OK();
206
7
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
4
                        const NullMap::value_type* null_map = nullptr) const override {
144
4
        using ToFieldType = typename ToDataType::FieldType;
145
4
        using FromFieldType = typename FromDataType::FieldType;
146
147
4
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
4
        const auto* col_from =
149
4
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
4
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
4
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
4
        UInt32 from_precision = from_decimal_type.get_precision();
157
4
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
4
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
4
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
4
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
4
        const auto& vec_from = col_from->get_data();
170
4
        const auto* vec_from_data = vec_from.data();
171
4
        auto& vec_to = col_to->get_data();
172
4
        auto* vec_to_data = vec_to.data();
173
174
4
        ColumnUInt8::MutablePtr col_null_map_to;
175
4
        NullMap::value_type* null_map_data = nullptr;
176
4
        if (overflow_and_nullable) {
177
4
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
4
            null_map_data = col_null_map_to->get_data().data();
179
4
        }
180
181
4
        CastParameters params;
182
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
4
        size_t size = vec_from.size();
184
4
        typename FromFieldType::NativeType scale_multiplier =
185
4
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
148
        for (size_t i = 0; i < size; i++) {
187
144
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
144
                                          typename ToDataType::FieldType>(
189
144
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
144
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
144
        }
198
199
4
        if (overflow_and_nullable) {
200
4
            block.get_by_position(result).column =
201
4
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
0
            block.get_by_position(result).column = std::move(col_to);
204
0
        }
205
4
        return Status::OK();
206
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
4
                        const NullMap::value_type* null_map = nullptr) const override {
144
4
        using ToFieldType = typename ToDataType::FieldType;
145
4
        using FromFieldType = typename FromDataType::FieldType;
146
147
4
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
4
        const auto* col_from =
149
4
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
4
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
4
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
4
        UInt32 from_precision = from_decimal_type.get_precision();
157
4
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
4
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
4
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
4
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
4
        const auto& vec_from = col_from->get_data();
170
4
        const auto* vec_from_data = vec_from.data();
171
4
        auto& vec_to = col_to->get_data();
172
4
        auto* vec_to_data = vec_to.data();
173
174
4
        ColumnUInt8::MutablePtr col_null_map_to;
175
4
        NullMap::value_type* null_map_data = nullptr;
176
4
        if (overflow_and_nullable) {
177
4
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
4
            null_map_data = col_null_map_to->get_data().data();
179
4
        }
180
181
4
        CastParameters params;
182
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
4
        size_t size = vec_from.size();
184
4
        typename FromFieldType::NativeType scale_multiplier =
185
4
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
148
        for (size_t i = 0; i < size; i++) {
187
144
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
144
                                          typename ToDataType::FieldType>(
189
144
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
144
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
144
        }
198
199
4
        if (overflow_and_nullable) {
200
4
            block.get_by_position(result).column =
201
4
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
0
            block.get_by_position(result).column = std::move(col_to);
204
0
        }
205
4
        return Status::OK();
206
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_4EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
7
                        const NullMap::value_type* null_map = nullptr) const override {
144
7
        using ToFieldType = typename ToDataType::FieldType;
145
7
        using FromFieldType = typename FromDataType::FieldType;
146
147
7
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
7
        const auto* col_from =
149
7
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
7
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
7
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
7
        UInt32 from_precision = from_decimal_type.get_precision();
157
7
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
7
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
7
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
7
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
7
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
7
        const auto& vec_from = col_from->get_data();
170
7
        const auto* vec_from_data = vec_from.data();
171
7
        auto& vec_to = col_to->get_data();
172
7
        auto* vec_to_data = vec_to.data();
173
174
7
        ColumnUInt8::MutablePtr col_null_map_to;
175
7
        NullMap::value_type* null_map_data = nullptr;
176
7
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
7
        CastParameters params;
182
7
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
7
        size_t size = vec_from.size();
184
7
        typename FromFieldType::NativeType scale_multiplier =
185
7
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
455
        for (size_t i = 0; i < size; i++) {
187
448
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
448
                                          typename ToDataType::FieldType>(
189
448
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
448
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
448
        }
198
199
7
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
7
        } else {
203
7
            block.get_by_position(result).column = std::move(col_to);
204
7
        }
205
7
        return Status::OK();
206
7
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
7
                        const NullMap::value_type* null_map = nullptr) const override {
144
7
        using ToFieldType = typename ToDataType::FieldType;
145
7
        using FromFieldType = typename FromDataType::FieldType;
146
147
7
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
7
        const auto* col_from =
149
7
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
7
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
7
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
7
        UInt32 from_precision = from_decimal_type.get_precision();
157
7
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
7
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
7
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
7
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
7
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
7
        const auto& vec_from = col_from->get_data();
170
7
        const auto* vec_from_data = vec_from.data();
171
7
        auto& vec_to = col_to->get_data();
172
7
        auto* vec_to_data = vec_to.data();
173
174
7
        ColumnUInt8::MutablePtr col_null_map_to;
175
7
        NullMap::value_type* null_map_data = nullptr;
176
7
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
7
        CastParameters params;
182
7
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
7
        size_t size = vec_from.size();
184
7
        typename FromFieldType::NativeType scale_multiplier =
185
7
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
455
        for (size_t i = 0; i < size; i++) {
187
448
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
448
                                          typename ToDataType::FieldType>(
189
448
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
448
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
448
        }
198
199
7
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
7
        } else {
203
7
            block.get_by_position(result).column = std::move(col_to);
204
7
        }
205
7
        return Status::OK();
206
7
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
3
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
3
            null_map_data = col_null_map_to->get_data().data();
179
3
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
623
        for (size_t i = 0; i < size; i++) {
187
614
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
614
                                          typename ToDataType::FieldType>(
189
614
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
614
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
614
        }
198
199
9
        if (overflow_and_nullable) {
200
3
            block.get_by_position(result).column =
201
3
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
6
        } else {
203
6
            block.get_by_position(result).column = std::move(col_to);
204
6
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
3
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
3
            null_map_data = col_null_map_to->get_data().data();
179
3
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
623
        for (size_t i = 0; i < size; i++) {
187
614
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
614
                                          typename ToDataType::FieldType>(
189
614
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
614
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
614
        }
198
199
9
        if (overflow_and_nullable) {
200
3
            block.get_by_position(result).column =
201
3
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
6
        } else {
203
6
            block.get_by_position(result).column = std::move(col_to);
204
6
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
4
                        const NullMap::value_type* null_map = nullptr) const override {
144
4
        using ToFieldType = typename ToDataType::FieldType;
145
4
        using FromFieldType = typename FromDataType::FieldType;
146
147
4
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
4
        const auto* col_from =
149
4
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
4
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
4
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
4
        UInt32 from_precision = from_decimal_type.get_precision();
157
4
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
4
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
4
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
4
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
4
        const auto& vec_from = col_from->get_data();
170
4
        const auto* vec_from_data = vec_from.data();
171
4
        auto& vec_to = col_to->get_data();
172
4
        auto* vec_to_data = vec_to.data();
173
174
4
        ColumnUInt8::MutablePtr col_null_map_to;
175
4
        NullMap::value_type* null_map_data = nullptr;
176
4
        if (overflow_and_nullable) {
177
4
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
4
            null_map_data = col_null_map_to->get_data().data();
179
4
        }
180
181
4
        CastParameters params;
182
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
4
        size_t size = vec_from.size();
184
4
        typename FromFieldType::NativeType scale_multiplier =
185
4
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
148
        for (size_t i = 0; i < size; i++) {
187
144
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
144
                                          typename ToDataType::FieldType>(
189
144
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
144
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
144
        }
198
199
4
        if (overflow_and_nullable) {
200
4
            block.get_by_position(result).column =
201
4
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
0
            block.get_by_position(result).column = std::move(col_to);
204
0
        }
205
4
        return Status::OK();
206
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
4
                        const NullMap::value_type* null_map = nullptr) const override {
144
4
        using ToFieldType = typename ToDataType::FieldType;
145
4
        using FromFieldType = typename FromDataType::FieldType;
146
147
4
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
4
        const auto* col_from =
149
4
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
4
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
4
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
4
        UInt32 from_precision = from_decimal_type.get_precision();
157
4
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
4
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
4
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
4
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
4
        const auto& vec_from = col_from->get_data();
170
4
        const auto* vec_from_data = vec_from.data();
171
4
        auto& vec_to = col_to->get_data();
172
4
        auto* vec_to_data = vec_to.data();
173
174
4
        ColumnUInt8::MutablePtr col_null_map_to;
175
4
        NullMap::value_type* null_map_data = nullptr;
176
4
        if (overflow_and_nullable) {
177
4
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
4
            null_map_data = col_null_map_to->get_data().data();
179
4
        }
180
181
4
        CastParameters params;
182
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
4
        size_t size = vec_from.size();
184
4
        typename FromFieldType::NativeType scale_multiplier =
185
4
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
148
        for (size_t i = 0; i < size; i++) {
187
144
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
144
                                          typename ToDataType::FieldType>(
189
144
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
144
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
144
        }
198
199
4
        if (overflow_and_nullable) {
200
4
            block.get_by_position(result).column =
201
4
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
0
            block.get_by_position(result).column = std::move(col_to);
204
0
        }
205
4
        return Status::OK();
206
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
7
                        const NullMap::value_type* null_map = nullptr) const override {
144
7
        using ToFieldType = typename ToDataType::FieldType;
145
7
        using FromFieldType = typename FromDataType::FieldType;
146
147
7
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
7
        const auto* col_from =
149
7
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
7
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
7
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
7
        UInt32 from_precision = from_decimal_type.get_precision();
157
7
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
7
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
7
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
7
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
7
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
7
        const auto& vec_from = col_from->get_data();
170
7
        const auto* vec_from_data = vec_from.data();
171
7
        auto& vec_to = col_to->get_data();
172
7
        auto* vec_to_data = vec_to.data();
173
174
7
        ColumnUInt8::MutablePtr col_null_map_to;
175
7
        NullMap::value_type* null_map_data = nullptr;
176
7
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
7
        CastParameters params;
182
7
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
7
        size_t size = vec_from.size();
184
7
        typename FromFieldType::NativeType scale_multiplier =
185
7
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
455
        for (size_t i = 0; i < size; i++) {
187
448
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
448
                                          typename ToDataType::FieldType>(
189
448
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
448
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
448
        }
198
199
7
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
7
        } else {
203
7
            block.get_by_position(result).column = std::move(col_to);
204
7
        }
205
7
        return Status::OK();
206
7
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
7
                        const NullMap::value_type* null_map = nullptr) const override {
144
7
        using ToFieldType = typename ToDataType::FieldType;
145
7
        using FromFieldType = typename FromDataType::FieldType;
146
147
7
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
7
        const auto* col_from =
149
7
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
7
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
7
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
7
        UInt32 from_precision = from_decimal_type.get_precision();
157
7
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
7
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
7
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
7
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
7
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
7
        const auto& vec_from = col_from->get_data();
170
7
        const auto* vec_from_data = vec_from.data();
171
7
        auto& vec_to = col_to->get_data();
172
7
        auto* vec_to_data = vec_to.data();
173
174
7
        ColumnUInt8::MutablePtr col_null_map_to;
175
7
        NullMap::value_type* null_map_data = nullptr;
176
7
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
7
        CastParameters params;
182
7
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
7
        size_t size = vec_from.size();
184
7
        typename FromFieldType::NativeType scale_multiplier =
185
7
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
455
        for (size_t i = 0; i < size; i++) {
187
448
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
448
                                          typename ToDataType::FieldType>(
189
448
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
448
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
448
        }
198
199
7
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
7
        } else {
203
7
            block.get_by_position(result).column = std::move(col_to);
204
7
        }
205
7
        return Status::OK();
206
7
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
713
        for (size_t i = 0; i < size; i++) {
187
704
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
704
                                          typename ToDataType::FieldType>(
189
704
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
704
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
704
        }
198
199
9
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
9
        } else {
203
9
            block.get_by_position(result).column = std::move(col_to);
204
9
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
713
        for (size_t i = 0; i < size; i++) {
187
704
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
704
                                          typename ToDataType::FieldType>(
189
704
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
704
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
704
        }
198
199
9
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
9
        } else {
203
9
            block.get_by_position(result).column = std::move(col_to);
204
9
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
4
                        const NullMap::value_type* null_map = nullptr) const override {
144
4
        using ToFieldType = typename ToDataType::FieldType;
145
4
        using FromFieldType = typename FromDataType::FieldType;
146
147
4
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
4
        const auto* col_from =
149
4
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
4
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
4
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
4
        UInt32 from_precision = from_decimal_type.get_precision();
157
4
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
4
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
4
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
4
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
4
        const auto& vec_from = col_from->get_data();
170
4
        const auto* vec_from_data = vec_from.data();
171
4
        auto& vec_to = col_to->get_data();
172
4
        auto* vec_to_data = vec_to.data();
173
174
4
        ColumnUInt8::MutablePtr col_null_map_to;
175
4
        NullMap::value_type* null_map_data = nullptr;
176
4
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
4
        CastParameters params;
182
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
4
        size_t size = vec_from.size();
184
4
        typename FromFieldType::NativeType scale_multiplier =
185
4
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
292
        for (size_t i = 0; i < size; i++) {
187
288
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
288
                                          typename ToDataType::FieldType>(
189
288
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
288
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
288
        }
198
199
4
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
4
        return Status::OK();
206
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
4
                        const NullMap::value_type* null_map = nullptr) const override {
144
4
        using ToFieldType = typename ToDataType::FieldType;
145
4
        using FromFieldType = typename FromDataType::FieldType;
146
147
4
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
4
        const auto* col_from =
149
4
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
4
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
4
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
4
        UInt32 from_precision = from_decimal_type.get_precision();
157
4
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
4
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
4
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
4
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
4
        const auto& vec_from = col_from->get_data();
170
4
        const auto* vec_from_data = vec_from.data();
171
4
        auto& vec_to = col_to->get_data();
172
4
        auto* vec_to_data = vec_to.data();
173
174
4
        ColumnUInt8::MutablePtr col_null_map_to;
175
4
        NullMap::value_type* null_map_data = nullptr;
176
4
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
4
        CastParameters params;
182
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
4
        size_t size = vec_from.size();
184
4
        typename FromFieldType::NativeType scale_multiplier =
185
4
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
292
        for (size_t i = 0; i < size; i++) {
187
288
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
288
                                          typename ToDataType::FieldType>(
189
288
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
288
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
288
        }
198
199
4
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
4
        return Status::OK();
206
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
4
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
4
            null_map_data = col_null_map_to->get_data().data();
179
4
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
551
        for (size_t i = 0; i < size; i++) {
187
542
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
542
                                          typename ToDataType::FieldType>(
189
542
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
542
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
542
        }
198
199
9
        if (overflow_and_nullable) {
200
4
            block.get_by_position(result).column =
201
4
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
5
            block.get_by_position(result).column = std::move(col_to);
204
5
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
4
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
4
            null_map_data = col_null_map_to->get_data().data();
179
4
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
551
        for (size_t i = 0; i < size; i++) {
187
542
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
542
                                          typename ToDataType::FieldType>(
189
542
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
542
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
542
        }
198
199
9
        if (overflow_and_nullable) {
200
4
            block.get_by_position(result).column =
201
4
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
5
            block.get_by_position(result).column = std::move(col_to);
204
5
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
5
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
5
            null_map_data = col_null_map_to->get_data().data();
179
5
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
479
        for (size_t i = 0; i < size; i++) {
187
470
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
470
                                          typename ToDataType::FieldType>(
189
470
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
470
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
470
        }
198
199
9
        if (overflow_and_nullable) {
200
5
            block.get_by_position(result).column =
201
5
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
5
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
7
                        const NullMap::value_type* null_map = nullptr) const override {
144
7
        using ToFieldType = typename ToDataType::FieldType;
145
7
        using FromFieldType = typename FromDataType::FieldType;
146
147
7
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
7
        const auto* col_from =
149
7
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
7
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
7
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
7
        UInt32 from_precision = from_decimal_type.get_precision();
157
7
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
7
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
7
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
7
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
7
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
7
        const auto& vec_from = col_from->get_data();
170
7
        const auto* vec_from_data = vec_from.data();
171
7
        auto& vec_to = col_to->get_data();
172
7
        auto* vec_to_data = vec_to.data();
173
174
7
        ColumnUInt8::MutablePtr col_null_map_to;
175
7
        NullMap::value_type* null_map_data = nullptr;
176
7
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
7
        CastParameters params;
182
7
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
7
        size_t size = vec_from.size();
184
7
        typename FromFieldType::NativeType scale_multiplier =
185
7
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
455
        for (size_t i = 0; i < size; i++) {
187
448
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
448
                                          typename ToDataType::FieldType>(
189
448
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
448
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
448
        }
198
199
7
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
7
        } else {
203
7
            block.get_by_position(result).column = std::move(col_to);
204
7
        }
205
7
        return Status::OK();
206
7
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
7
                        const NullMap::value_type* null_map = nullptr) const override {
144
7
        using ToFieldType = typename ToDataType::FieldType;
145
7
        using FromFieldType = typename FromDataType::FieldType;
146
147
7
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
7
        const auto* col_from =
149
7
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
7
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
7
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
7
        UInt32 from_precision = from_decimal_type.get_precision();
157
7
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
7
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
7
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
7
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
7
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
7
        const auto& vec_from = col_from->get_data();
170
7
        const auto* vec_from_data = vec_from.data();
171
7
        auto& vec_to = col_to->get_data();
172
7
        auto* vec_to_data = vec_to.data();
173
174
7
        ColumnUInt8::MutablePtr col_null_map_to;
175
7
        NullMap::value_type* null_map_data = nullptr;
176
7
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
7
        CastParameters params;
182
7
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
7
        size_t size = vec_from.size();
184
7
        typename FromFieldType::NativeType scale_multiplier =
185
7
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
455
        for (size_t i = 0; i < size; i++) {
187
448
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
448
                                          typename ToDataType::FieldType>(
189
448
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
448
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
448
        }
198
199
7
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
7
        } else {
203
7
            block.get_by_position(result).column = std::move(col_to);
204
7
        }
205
7
        return Status::OK();
206
7
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
713
        for (size_t i = 0; i < size; i++) {
187
704
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
704
                                          typename ToDataType::FieldType>(
189
704
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
704
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
704
        }
198
199
9
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
9
        } else {
203
9
            block.get_by_position(result).column = std::move(col_to);
204
9
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
713
        for (size_t i = 0; i < size; i++) {
187
704
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
704
                                          typename ToDataType::FieldType>(
189
704
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
704
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
704
        }
198
199
9
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
9
        } else {
203
9
            block.get_by_position(result).column = std::move(col_to);
204
9
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
4
                        const NullMap::value_type* null_map = nullptr) const override {
144
4
        using ToFieldType = typename ToDataType::FieldType;
145
4
        using FromFieldType = typename FromDataType::FieldType;
146
147
4
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
4
        const auto* col_from =
149
4
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
4
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
4
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
4
        UInt32 from_precision = from_decimal_type.get_precision();
157
4
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
4
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
4
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
4
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
4
        const auto& vec_from = col_from->get_data();
170
4
        const auto* vec_from_data = vec_from.data();
171
4
        auto& vec_to = col_to->get_data();
172
4
        auto* vec_to_data = vec_to.data();
173
174
4
        ColumnUInt8::MutablePtr col_null_map_to;
175
4
        NullMap::value_type* null_map_data = nullptr;
176
4
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
4
        CastParameters params;
182
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
4
        size_t size = vec_from.size();
184
4
        typename FromFieldType::NativeType scale_multiplier =
185
4
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
292
        for (size_t i = 0; i < size; i++) {
187
288
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
288
                                          typename ToDataType::FieldType>(
189
288
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
288
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
288
        }
198
199
4
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
4
        return Status::OK();
206
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
4
                        const NullMap::value_type* null_map = nullptr) const override {
144
4
        using ToFieldType = typename ToDataType::FieldType;
145
4
        using FromFieldType = typename FromDataType::FieldType;
146
147
4
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
4
        const auto* col_from =
149
4
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
4
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
4
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
4
        UInt32 from_precision = from_decimal_type.get_precision();
157
4
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
4
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
4
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
4
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
4
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
4
        const auto& vec_from = col_from->get_data();
170
4
        const auto* vec_from_data = vec_from.data();
171
4
        auto& vec_to = col_to->get_data();
172
4
        auto* vec_to_data = vec_to.data();
173
174
4
        ColumnUInt8::MutablePtr col_null_map_to;
175
4
        NullMap::value_type* null_map_data = nullptr;
176
4
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
4
        CastParameters params;
182
4
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
4
        size_t size = vec_from.size();
184
4
        typename FromFieldType::NativeType scale_multiplier =
185
4
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
292
        for (size_t i = 0; i < size; i++) {
187
288
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
288
                                          typename ToDataType::FieldType>(
189
288
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
288
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
288
        }
198
199
4
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
4
        } else {
203
4
            block.get_by_position(result).column = std::move(col_to);
204
4
        }
205
4
        return Status::OK();
206
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
713
        for (size_t i = 0; i < size; i++) {
187
704
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
704
                                          typename ToDataType::FieldType>(
189
704
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
704
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
704
        }
198
199
9
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
9
        } else {
203
9
            block.get_by_position(result).column = std::move(col_to);
204
9
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
0
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
0
            null_map_data = col_null_map_to->get_data().data();
179
0
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
713
        for (size_t i = 0; i < size; i++) {
187
704
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
704
                                          typename ToDataType::FieldType>(
189
704
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
704
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
704
        }
198
199
9
        if (overflow_and_nullable) {
200
0
            block.get_by_position(result).column =
201
0
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
9
        } else {
203
9
            block.get_by_position(result).column = std::move(col_to);
204
9
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
3
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
3
            null_map_data = col_null_map_to->get_data().data();
179
3
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
623
        for (size_t i = 0; i < size; i++) {
187
614
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
614
                                          typename ToDataType::FieldType>(
189
614
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
614
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
614
        }
198
199
9
        if (overflow_and_nullable) {
200
3
            block.get_by_position(result).column =
201
3
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
6
        } else {
203
6
            block.get_by_position(result).column = std::move(col_to);
204
6
        }
205
9
        return Status::OK();
206
9
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS_14DataTypeNumberILS3_7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
143
9
                        const NullMap::value_type* null_map = nullptr) const override {
144
9
        using ToFieldType = typename ToDataType::FieldType;
145
9
        using FromFieldType = typename FromDataType::FieldType;
146
147
9
        const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]);
148
9
        const auto* col_from =
149
9
                check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get());
150
9
        if (!col_from) {
151
0
            return Status::InternalError(fmt::format("Column type mismatch: expected {}, got {}",
152
0
                                                     type_to_string(FromDataType::PType),
153
0
                                                     named_from.column->get_name()));
154
0
        }
155
9
        const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type);
156
9
        UInt32 from_precision = from_decimal_type.get_precision();
157
9
        UInt32 from_scale = from_decimal_type.get_scale();
158
159
9
        constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
160
9
        bool narrow_integral = (from_precision - from_scale) >= to_max_digits;
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
        bool overflow_and_nullable = (from_precision - from_scale) >= to_max_digits;
165
        // only in non-strict mode and may overflow, we set nullable
166
9
        bool set_nullable = (CastMode == CastModeType::NonStrictMode) && overflow_and_nullable;
167
168
9
        auto col_to = ToDataType::ColumnType::create(input_rows_count);
169
9
        const auto& vec_from = col_from->get_data();
170
9
        const auto* vec_from_data = vec_from.data();
171
9
        auto& vec_to = col_to->get_data();
172
9
        auto* vec_to_data = vec_to.data();
173
174
9
        ColumnUInt8::MutablePtr col_null_map_to;
175
9
        NullMap::value_type* null_map_data = nullptr;
176
9
        if (overflow_and_nullable) {
177
3
            col_null_map_to = ColumnUInt8::create(input_rows_count, 0);
178
3
            null_map_data = col_null_map_to->get_data().data();
179
3
        }
180
181
9
        CastParameters params;
182
9
        params.is_strict = (CastMode == CastModeType::StrictMode);
183
9
        size_t size = vec_from.size();
184
9
        typename FromFieldType::NativeType scale_multiplier =
185
9
                DataTypeDecimal<FromDataType::PType>::get_scale_multiplier(from_scale);
186
623
        for (size_t i = 0; i < size; i++) {
187
614
            if (!CastToInt::_from_decimal<typename FromDataType::FieldType,
188
614
                                          typename ToDataType::FieldType>(
189
614
                        vec_from_data[i], from_precision, from_scale, vec_to_data[i],
190
614
                        scale_multiplier, narrow_integral, params)) {
191
0
                if (set_nullable) {
192
0
                    null_map_data[i] = 1;
193
0
                } else {
194
0
                    return params.status;
195
0
                }
196
0
            }
197
614
        }
198
199
9
        if (overflow_and_nullable) {
200
3
            block.get_by_position(result).column =
201
3
                    ColumnNullable::create(std::move(col_to), std::move(col_null_map_to));
202
6
        } else {
203
6
            block.get_by_position(result).column = std::move(col_to);
204
6
        }
205
9
        return Status::OK();
206
9
    }
207
};
208
209
template <typename T>
210
constexpr static bool int_allow_cast_from_date =
211
        std::is_same_v<T, DataTypeInt32> || std::is_same_v<T, DataTypeInt64> ||
212
        std::is_same_v<T, DataTypeInt128>;
213
214
template <typename T>
215
constexpr static bool int_allow_cast_from_datetime =
216
        std::is_same_v<T, DataTypeInt64> || std::is_same_v<T, DataTypeInt128>;
217
218
// cast from date and datetime to int
219
template <CastModeType CastMode, typename FromDataType, typename ToDataType>
220
    requires(((IsDateType<FromDataType> ||
221
               IsDateV2Type<FromDataType>)&&int_allow_cast_from_date<ToDataType>) ||
222
             ((IsDateTimeType<FromDataType> ||
223
               IsDateTimeV2Type<FromDataType>)&&int_allow_cast_from_datetime<ToDataType>))
224
class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase {
225
public:
226
    Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
227
                        uint32_t result, size_t input_rows_count,
228
22
                        const NullMap::value_type* null_map = nullptr) const override {
229
22
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
22
                                                                 input_rows_count);
231
22
    }
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
228
1
                        const NullMap::value_type* null_map = nullptr) const override {
229
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
1
                                                                 input_rows_count);
231
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
1
                        const NullMap::value_type* null_map = nullptr) const override {
229
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
1
                                                                 input_rows_count);
231
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
228
1
                        const NullMap::value_type* null_map = nullptr) const override {
229
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
1
                                                                 input_rows_count);
231
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
1
                        const NullMap::value_type* null_map = nullptr) const override {
229
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
1
                                                                 input_rows_count);
231
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_18DataTypeDateTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
4
                        const NullMap::value_type* null_map = nullptr) const override {
229
4
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
4
                                                                 input_rows_count);
231
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_18DataTypeDateTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
4
                        const NullMap::value_type* null_map = nullptr) const override {
229
4
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
4
                                                                 input_rows_count);
231
4
    }
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
228
1
                        const NullMap::value_type* null_map = nullptr) const override {
229
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
1
                                                                 input_rows_count);
231
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeDateV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
1
                        const NullMap::value_type* null_map = nullptr) const override {
229
1
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
1
                                                                 input_rows_count);
231
1
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_18DataTypeDateTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
4
                        const NullMap::value_type* null_map = nullptr) const override {
229
4
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
4
                                                                 input_rows_count);
231
4
    }
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_18DataTypeDateTimeV2ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Line
Count
Source
228
4
                        const NullMap::value_type* null_map = nullptr) const override {
229
4
        return static_cast_no_overflow<FromDataType, ToDataType>(context, block, arguments, result,
230
4
                                                                 input_rows_count);
231
4
    }
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_16DataTypeDateTimeENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_16DataTypeDateTimeENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh
232
};
233
namespace CastWrapper {
234
235
template <typename ToDataType>
236
6.22k
WrapperType create_int_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
237
6.22k
    std::shared_ptr<CastToBase> cast_impl;
238
239
6.22k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
6.22k
        using Types = std::decay_t<decltype(types)>;
241
6.22k
        using FromDataType = typename Types::LeftType;
242
6.22k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
6.22k
            if (context->enable_strict_mode()) {
244
5.00k
                cast_impl = std::make_shared<
245
5.00k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
5.00k
            } else {
247
1.22k
                cast_impl = std::make_shared<
248
1.22k
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1.22k
            }
250
6.22k
            return true;
251
6.22k
        } else {
252
0
            return false;
253
0
        }
254
6.22k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_2EEEvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_4EEEvEEEEbSS_
Line
Count
Source
239
7
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
7
        using Types = std::decay_t<decltype(types)>;
241
7
        using FromDataType = typename Types::LeftType;
242
7
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
7
            if (context->enable_strict_mode()) {
244
5
                cast_impl = std::make_shared<
245
5
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
5
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
7
            return true;
251
        } else {
252
            return false;
253
        }
254
7
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_5EEEvEEEEbSS_
Line
Count
Source
239
7
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
7
        using Types = std::decay_t<decltype(types)>;
241
7
        using FromDataType = typename Types::LeftType;
242
7
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
7
            if (context->enable_strict_mode()) {
244
5
                cast_impl = std::make_shared<
245
5
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
5
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
7
            return true;
251
        } else {
252
            return false;
253
        }
254
7
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_6EEEvEEEEbSS_
Line
Count
Source
239
7
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
7
        using Types = std::decay_t<decltype(types)>;
241
7
        using FromDataType = typename Types::LeftType;
242
7
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
7
            if (context->enable_strict_mode()) {
244
5
                cast_impl = std::make_shared<
245
5
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
5
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
7
            return true;
251
        } else {
252
            return false;
253
        }
254
7
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_7EEEvEEEEbSS_
Line
Count
Source
239
7
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
7
        using Types = std::decay_t<decltype(types)>;
241
7
        using FromDataType = typename Types::LeftType;
242
7
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
7
            if (context->enable_strict_mode()) {
244
5
                cast_impl = std::make_shared<
245
5
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
5
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
7
            return true;
251
        } else {
252
            return false;
253
        }
254
7
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_8EEEvEEEEbSS_
Line
Count
Source
239
23
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
23
        using Types = std::decay_t<decltype(types)>;
241
23
        using FromDataType = typename Types::LeftType;
242
23
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
23
            if (context->enable_strict_mode()) {
244
21
                cast_impl = std::make_shared<
245
21
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
21
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
23
            return true;
251
        } else {
252
            return false;
253
        }
254
23
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_9EEEvEEEEbSS_
Line
Count
Source
239
27
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
27
        using Types = std::decay_t<decltype(types)>;
241
27
        using FromDataType = typename Types::LeftType;
242
27
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
27
            if (context->enable_strict_mode()) {
244
25
                cast_impl = std::make_shared<
245
25
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
25
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
27
            return true;
251
        } else {
252
            return false;
253
        }
254
27
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_28EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
7
                cast_impl = std::make_shared<
245
7
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
7
            } else {
247
7
                cast_impl = std::make_shared<
248
7
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
7
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_29EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_20EEEvEEEEbSS_
Line
Count
Source
239
8
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
8
        using Types = std::decay_t<decltype(types)>;
241
8
        using FromDataType = typename Types::LeftType;
242
8
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
8
            if (context->enable_strict_mode()) {
244
4
                cast_impl = std::make_shared<
245
4
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
4
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
8
            return true;
251
        } else {
252
            return false;
253
        }
254
8
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_30EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_35EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_
Line
Count
Source
239
72
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
72
        using Types = std::decay_t<decltype(types)>;
241
72
        using FromDataType = typename Types::LeftType;
242
72
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
72
            if (context->enable_strict_mode()) {
244
36
                cast_impl = std::make_shared<
245
36
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
36
            } else {
247
36
                cast_impl = std::make_shared<
248
36
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
36
            }
250
72
            return true;
251
        } else {
252
            return false;
253
        }
254
72
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_
Line
Count
Source
239
24
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
24
        using Types = std::decay_t<decltype(types)>;
241
24
        using FromDataType = typename Types::LeftType;
242
24
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
24
            if (context->enable_strict_mode()) {
244
12
                cast_impl = std::make_shared<
245
12
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
12
            } else {
247
12
                cast_impl = std::make_shared<
248
12
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
12
            }
250
24
            return true;
251
        } else {
252
            return false;
253
        }
254
24
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_
Line
Count
Source
239
320
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
320
        using Types = std::decay_t<decltype(types)>;
241
320
        using FromDataType = typename Types::LeftType;
242
320
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
320
            if (context->enable_strict_mode()) {
244
160
                cast_impl = std::make_shared<
245
160
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
160
            } else {
247
160
                cast_impl = std::make_shared<
248
160
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
160
            }
250
320
            return true;
251
        } else {
252
            return false;
253
        }
254
320
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_
Line
Count
Source
239
857
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
857
        using Types = std::decay_t<decltype(types)>;
241
857
        using FromDataType = typename Types::LeftType;
242
857
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
857
            if (context->enable_strict_mode()) {
244
832
                cast_impl = std::make_shared<
245
832
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
832
            } else {
247
25
                cast_impl = std::make_shared<
248
25
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
25
            }
250
857
            return true;
251
        } else {
252
            return false;
253
        }
254
857
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_2EEEvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_3EEEvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_5EEEvEEEEbSS_
Line
Count
Source
239
7
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
7
        using Types = std::decay_t<decltype(types)>;
241
7
        using FromDataType = typename Types::LeftType;
242
7
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
7
            if (context->enable_strict_mode()) {
244
5
                cast_impl = std::make_shared<
245
5
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
5
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
7
            return true;
251
        } else {
252
            return false;
253
        }
254
7
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_6EEEvEEEEbSS_
Line
Count
Source
239
7
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
7
        using Types = std::decay_t<decltype(types)>;
241
7
        using FromDataType = typename Types::LeftType;
242
7
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
7
            if (context->enable_strict_mode()) {
244
5
                cast_impl = std::make_shared<
245
5
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
5
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
7
            return true;
251
        } else {
252
            return false;
253
        }
254
7
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_7EEEvEEEEbSS_
Line
Count
Source
239
7
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
7
        using Types = std::decay_t<decltype(types)>;
241
7
        using FromDataType = typename Types::LeftType;
242
7
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
7
            if (context->enable_strict_mode()) {
244
5
                cast_impl = std::make_shared<
245
5
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
5
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
7
            return true;
251
        } else {
252
            return false;
253
        }
254
7
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_8EEEvEEEEbSS_
Line
Count
Source
239
21
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
21
        using Types = std::decay_t<decltype(types)>;
241
21
        using FromDataType = typename Types::LeftType;
242
21
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
21
            if (context->enable_strict_mode()) {
244
19
                cast_impl = std::make_shared<
245
19
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
19
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
21
            return true;
251
        } else {
252
            return false;
253
        }
254
21
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_9EEEvEEEEbSS_
Line
Count
Source
239
25
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
25
        using Types = std::decay_t<decltype(types)>;
241
25
        using FromDataType = typename Types::LeftType;
242
25
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
25
            if (context->enable_strict_mode()) {
244
23
                cast_impl = std::make_shared<
245
23
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
23
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
25
            return true;
251
        } else {
252
            return false;
253
        }
254
25
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_28EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
7
                cast_impl = std::make_shared<
245
7
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
7
            } else {
247
7
                cast_impl = std::make_shared<
248
7
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
7
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_29EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_20EEEvEEEEbSS_
Line
Count
Source
239
8
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
8
        using Types = std::decay_t<decltype(types)>;
241
8
        using FromDataType = typename Types::LeftType;
242
8
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
8
            if (context->enable_strict_mode()) {
244
4
                cast_impl = std::make_shared<
245
4
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
4
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
8
            return true;
251
        } else {
252
            return false;
253
        }
254
8
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_30EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_35EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_
Line
Count
Source
239
72
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
72
        using Types = std::decay_t<decltype(types)>;
241
72
        using FromDataType = typename Types::LeftType;
242
72
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
72
            if (context->enable_strict_mode()) {
244
36
                cast_impl = std::make_shared<
245
36
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
36
            } else {
247
36
                cast_impl = std::make_shared<
248
36
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
36
            }
250
72
            return true;
251
        } else {
252
            return false;
253
        }
254
72
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_
Line
Count
Source
239
24
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
24
        using Types = std::decay_t<decltype(types)>;
241
24
        using FromDataType = typename Types::LeftType;
242
24
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
24
            if (context->enable_strict_mode()) {
244
12
                cast_impl = std::make_shared<
245
12
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
12
            } else {
247
12
                cast_impl = std::make_shared<
248
12
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
12
            }
250
24
            return true;
251
        } else {
252
            return false;
253
        }
254
24
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_
Line
Count
Source
239
320
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
320
        using Types = std::decay_t<decltype(types)>;
241
320
        using FromDataType = typename Types::LeftType;
242
320
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
320
            if (context->enable_strict_mode()) {
244
160
                cast_impl = std::make_shared<
245
160
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
160
            } else {
247
160
                cast_impl = std::make_shared<
248
160
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
160
            }
250
320
            return true;
251
        } else {
252
            return false;
253
        }
254
320
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_
Line
Count
Source
239
841
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
841
        using Types = std::decay_t<decltype(types)>;
241
841
        using FromDataType = typename Types::LeftType;
242
841
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
841
            if (context->enable_strict_mode()) {
244
816
                cast_impl = std::make_shared<
245
816
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
816
            } else {
247
25
                cast_impl = std::make_shared<
248
25
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
25
            }
250
841
            return true;
251
        } else {
252
            return false;
253
        }
254
841
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_2EEEvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_3EEEvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_4EEEvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_6EEEvEEEEbSS_
Line
Count
Source
239
7
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
7
        using Types = std::decay_t<decltype(types)>;
241
7
        using FromDataType = typename Types::LeftType;
242
7
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
7
            if (context->enable_strict_mode()) {
244
5
                cast_impl = std::make_shared<
245
5
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
5
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
7
            return true;
251
        } else {
252
            return false;
253
        }
254
7
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_7EEEvEEEEbSS_
Line
Count
Source
239
7
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
7
        using Types = std::decay_t<decltype(types)>;
241
7
        using FromDataType = typename Types::LeftType;
242
7
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
7
            if (context->enable_strict_mode()) {
244
5
                cast_impl = std::make_shared<
245
5
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
5
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
7
            return true;
251
        } else {
252
            return false;
253
        }
254
7
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_8EEEvEEEEbSS_
Line
Count
Source
239
17
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
17
        using Types = std::decay_t<decltype(types)>;
241
17
        using FromDataType = typename Types::LeftType;
242
17
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
17
            if (context->enable_strict_mode()) {
244
15
                cast_impl = std::make_shared<
245
15
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
15
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
17
            return true;
251
        } else {
252
            return false;
253
        }
254
17
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_9EEEvEEEEbSS_
Line
Count
Source
239
21
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
21
        using Types = std::decay_t<decltype(types)>;
241
21
        using FromDataType = typename Types::LeftType;
242
21
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
21
            if (context->enable_strict_mode()) {
244
19
                cast_impl = std::make_shared<
245
19
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
19
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
21
            return true;
251
        } else {
252
            return false;
253
        }
254
21
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_28EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
7
                cast_impl = std::make_shared<
245
7
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
7
            } else {
247
7
                cast_impl = std::make_shared<
248
7
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
7
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_29EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_20EEEvEEEEbSS_
Line
Count
Source
239
8
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
8
        using Types = std::decay_t<decltype(types)>;
241
8
        using FromDataType = typename Types::LeftType;
242
8
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
8
            if (context->enable_strict_mode()) {
244
4
                cast_impl = std::make_shared<
245
4
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
4
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
8
            return true;
251
        } else {
252
            return false;
253
        }
254
8
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_30EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_35EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_
Line
Count
Source
239
24
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
24
        using Types = std::decay_t<decltype(types)>;
241
24
        using FromDataType = typename Types::LeftType;
242
24
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
24
            if (context->enable_strict_mode()) {
244
12
                cast_impl = std::make_shared<
245
12
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
12
            } else {
247
12
                cast_impl = std::make_shared<
248
12
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
12
            }
250
24
            return true;
251
        } else {
252
            return false;
253
        }
254
24
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_
Line
Count
Source
239
276
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
276
        using Types = std::decay_t<decltype(types)>;
241
276
        using FromDataType = typename Types::LeftType;
242
276
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
276
            if (context->enable_strict_mode()) {
244
138
                cast_impl = std::make_shared<
245
138
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
138
            } else {
247
138
                cast_impl = std::make_shared<
248
138
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
138
            }
250
276
            return true;
251
        } else {
252
            return false;
253
        }
254
276
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_
Line
Count
Source
239
826
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
826
        using Types = std::decay_t<decltype(types)>;
241
826
        using FromDataType = typename Types::LeftType;
242
826
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
826
            if (context->enable_strict_mode()) {
244
800
                cast_impl = std::make_shared<
245
800
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
800
            } else {
247
26
                cast_impl = std::make_shared<
248
26
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
26
            }
250
826
            return true;
251
        } else {
252
            return false;
253
        }
254
826
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_2EEEvEEEEbSS_
Line
Count
Source
239
78
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
78
        using Types = std::decay_t<decltype(types)>;
241
78
        using FromDataType = typename Types::LeftType;
242
78
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
78
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
76
            } else {
247
76
                cast_impl = std::make_shared<
248
76
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
76
            }
250
78
            return true;
251
        } else {
252
            return false;
253
        }
254
78
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_3EEEvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_4EEEvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_5EEEvEEEEbSS_
Line
Count
Source
239
3
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
3
        using Types = std::decay_t<decltype(types)>;
241
3
        using FromDataType = typename Types::LeftType;
242
3
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
3
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
3
            return true;
251
        } else {
252
            return false;
253
        }
254
3
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_7EEEvEEEEbSS_
Line
Count
Source
239
7
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
7
        using Types = std::decay_t<decltype(types)>;
241
7
        using FromDataType = typename Types::LeftType;
242
7
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
7
            if (context->enable_strict_mode()) {
244
5
                cast_impl = std::make_shared<
245
5
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
5
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
7
            return true;
251
        } else {
252
            return false;
253
        }
254
7
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_8EEEvEEEEbSS_
Line
Count
Source
239
13
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
13
        using Types = std::decay_t<decltype(types)>;
241
13
        using FromDataType = typename Types::LeftType;
242
13
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
13
            if (context->enable_strict_mode()) {
244
11
                cast_impl = std::make_shared<
245
11
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
11
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
13
            return true;
251
        } else {
252
            return false;
253
        }
254
13
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_9EEEvEEEEbSS_
Line
Count
Source
239
17
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
17
        using Types = std::decay_t<decltype(types)>;
241
17
        using FromDataType = typename Types::LeftType;
242
17
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
17
            if (context->enable_strict_mode()) {
244
15
                cast_impl = std::make_shared<
245
15
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
15
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
17
            return true;
251
        } else {
252
            return false;
253
        }
254
17
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_28EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
7
                cast_impl = std::make_shared<
245
7
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
7
            } else {
247
7
                cast_impl = std::make_shared<
248
7
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
7
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_29EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_20EEEvEEEEbSS_
Line
Count
Source
239
8
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
8
        using Types = std::decay_t<decltype(types)>;
241
8
        using FromDataType = typename Types::LeftType;
242
8
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
8
            if (context->enable_strict_mode()) {
244
4
                cast_impl = std::make_shared<
245
4
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
4
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
8
            return true;
251
        } else {
252
            return false;
253
        }
254
8
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_30EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_35EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_
Line
Count
Source
239
8
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
8
        using Types = std::decay_t<decltype(types)>;
241
8
        using FromDataType = typename Types::LeftType;
242
8
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
8
            if (context->enable_strict_mode()) {
244
4
                cast_impl = std::make_shared<
245
4
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
4
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
8
            return true;
251
        } else {
252
            return false;
253
        }
254
8
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_
Line
Count
Source
239
809
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
809
        using Types = std::decay_t<decltype(types)>;
241
809
        using FromDataType = typename Types::LeftType;
242
809
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
809
            if (context->enable_strict_mode()) {
244
784
                cast_impl = std::make_shared<
245
784
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
784
            } else {
247
25
                cast_impl = std::make_shared<
248
25
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
25
            }
250
809
            return true;
251
        } else {
252
            return false;
253
        }
254
809
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_2EEEvEEEEbSS_
Line
Count
Source
239
104
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
104
        using Types = std::decay_t<decltype(types)>;
241
104
        using FromDataType = typename Types::LeftType;
242
104
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
104
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
103
            } else {
247
103
                cast_impl = std::make_shared<
248
103
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
103
            }
250
104
            return true;
251
        } else {
252
            return false;
253
        }
254
104
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_3EEEvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_4EEEvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_5EEEvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_6EEEvEEEEbSS_
Line
Count
Source
239
96
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
96
        using Types = std::decay_t<decltype(types)>;
241
96
        using FromDataType = typename Types::LeftType;
242
96
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
96
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
95
            } else {
247
95
                cast_impl = std::make_shared<
248
95
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
95
            }
250
96
            return true;
251
        } else {
252
            return false;
253
        }
254
96
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairIS4_vEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_8EEEvEEEEbSS_
Line
Count
Source
239
9
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
9
        using Types = std::decay_t<decltype(types)>;
241
9
        using FromDataType = typename Types::LeftType;
242
9
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
9
            if (context->enable_strict_mode()) {
244
7
                cast_impl = std::make_shared<
245
7
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
7
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
9
            return true;
251
        } else {
252
            return false;
253
        }
254
9
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS2_ILS3_9EEEvEEEEbSS_
Line
Count
Source
239
13
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
13
        using Types = std::decay_t<decltype(types)>;
241
13
        using FromDataType = typename Types::LeftType;
242
13
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
13
            if (context->enable_strict_mode()) {
244
11
                cast_impl = std::make_shared<
245
11
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
11
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
13
            return true;
251
        } else {
252
            return false;
253
        }
254
13
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_28EEEvEEEEbSS_
Line
Count
Source
239
14
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
14
        using Types = std::decay_t<decltype(types)>;
241
14
        using FromDataType = typename Types::LeftType;
242
14
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
14
            if (context->enable_strict_mode()) {
244
7
                cast_impl = std::make_shared<
245
7
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
7
            } else {
247
7
                cast_impl = std::make_shared<
248
7
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
7
            }
250
14
            return true;
251
        } else {
252
            return false;
253
        }
254
14
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_29EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_20EEEvEEEEbSS_
Line
Count
Source
239
8
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
8
        using Types = std::decay_t<decltype(types)>;
241
8
        using FromDataType = typename Types::LeftType;
242
8
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
8
            if (context->enable_strict_mode()) {
244
4
                cast_impl = std::make_shared<
245
4
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
4
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
8
            return true;
251
        } else {
252
            return false;
253
        }
254
8
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_30EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_15DataTypeDecimalILS3_35EEEvEEEEbSS_
Line
Count
Source
239
18
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
18
        using Types = std::decay_t<decltype(types)>;
241
18
        using FromDataType = typename Types::LeftType;
242
18
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
18
            if (context->enable_strict_mode()) {
244
9
                cast_impl = std::make_shared<
245
9
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
9
            } else {
247
9
                cast_impl = std::make_shared<
248
9
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
9
            }
250
18
            return true;
251
        } else {
252
            return false;
253
        }
254
18
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeDateEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeDateV2EvEEEEbSS_
Line
Count
Source
239
2
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
2
        using Types = std::decay_t<decltype(types)>;
241
2
        using FromDataType = typename Types::LeftType;
242
2
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
2
            if (context->enable_strict_mode()) {
244
1
                cast_impl = std::make_shared<
245
1
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1
            } else {
247
1
                cast_impl = std::make_shared<
248
1
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1
            }
250
2
            return true;
251
        } else {
252
            return false;
253
        }
254
2
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbSS_
Line
Count
Source
239
8
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
8
        using Types = std::decay_t<decltype(types)>;
241
8
        using FromDataType = typename Types::LeftType;
242
8
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
8
            if (context->enable_strict_mode()) {
244
4
                cast_impl = std::make_shared<
245
4
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
4
            } else {
247
4
                cast_impl = std::make_shared<
248
4
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
4
            }
250
8
            return true;
251
        } else {
252
            return false;
253
        }
254
8
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbSS_
Line
Count
Source
239
4
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
4
        using Types = std::decay_t<decltype(types)>;
241
4
        using FromDataType = typename Types::LeftType;
242
4
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
4
            if (context->enable_strict_mode()) {
244
2
                cast_impl = std::make_shared<
245
2
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
2
            } else {
247
2
                cast_impl = std::make_shared<
248
2
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
2
            }
250
4
            return true;
251
        } else {
252
            return false;
253
        }
254
4
    };
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv4EvEEEEbSS_
Unexecuted instantiation: _ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_12DataTypeIPv6EvEEEEbSS_
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlRKT_E_clINS_8TypePairINS_14DataTypeStringEvEEEEbSS_
Line
Count
Source
239
793
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
793
        using Types = std::decay_t<decltype(types)>;
241
793
        using FromDataType = typename Types::LeftType;
242
793
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
793
            if (context->enable_strict_mode()) {
244
768
                cast_impl = std::make_shared<
245
768
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
768
            } else {
247
25
                cast_impl = std::make_shared<
248
25
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
25
            }
250
793
            return true;
251
        } else {
252
            return false;
253
        }
254
793
    };
255
256
6.22k
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) {
257
0
        return create_unsupport_wrapper(
258
0
                fmt::format("CAST AS number not supported {}", from_type->get_name()));
259
0
    }
260
261
6.22k
    return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
262
6.22k
                       uint32_t result, size_t input_rows_count,
263
6.22k
                       const NullMap::value_type* null_map = nullptr) {
264
6.22k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
6.22k
                                       null_map);
266
6.22k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_
Line
Count
Source
263
1.42k
                       const NullMap::value_type* null_map = nullptr) {
264
1.42k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
1.42k
                                       null_map);
266
1.42k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_
Line
Count
Source
263
1.40k
                       const NullMap::value_type* null_map = nullptr) {
264
1.40k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
1.40k
                                       null_map);
266
1.40k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_
Line
Count
Source
263
1.26k
                       const NullMap::value_type* null_map = nullptr) {
264
1.26k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
1.26k
                                       null_map);
266
1.26k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_
Line
Count
Source
263
1.02k
                       const NullMap::value_type* null_map = nullptr) {
264
1.02k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
1.02k
                                       null_map);
266
1.02k
    };
_ZZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEEENKUlS8_SA_SF_jmSH_E_clES8_SA_SF_jmSH_
Line
Count
Source
263
1.11k
                       const NullMap::value_type* null_map = nullptr) {
264
1.11k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
1.11k
                                       null_map);
266
1.11k
    };
267
6.22k
}
_ZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE
Line
Count
Source
236
1.42k
WrapperType create_int_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
237
1.42k
    std::shared_ptr<CastToBase> cast_impl;
238
239
1.42k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
1.42k
        using Types = std::decay_t<decltype(types)>;
241
1.42k
        using FromDataType = typename Types::LeftType;
242
1.42k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
1.42k
            if (context->enable_strict_mode()) {
244
1.42k
                cast_impl = std::make_shared<
245
1.42k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1.42k
            } else {
247
1.42k
                cast_impl = std::make_shared<
248
1.42k
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1.42k
            }
250
1.42k
            return true;
251
1.42k
        } else {
252
1.42k
            return false;
253
1.42k
        }
254
1.42k
    };
255
256
1.42k
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) {
257
0
        return create_unsupport_wrapper(
258
0
                fmt::format("CAST AS number not supported {}", from_type->get_name()));
259
0
    }
260
261
1.42k
    return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
262
1.42k
                       uint32_t result, size_t input_rows_count,
263
1.42k
                       const NullMap::value_type* null_map = nullptr) {
264
1.42k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
1.42k
                                       null_map);
266
1.42k
    };
267
1.42k
}
_ZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE
Line
Count
Source
236
1.40k
WrapperType create_int_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
237
1.40k
    std::shared_ptr<CastToBase> cast_impl;
238
239
1.40k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
1.40k
        using Types = std::decay_t<decltype(types)>;
241
1.40k
        using FromDataType = typename Types::LeftType;
242
1.40k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
1.40k
            if (context->enable_strict_mode()) {
244
1.40k
                cast_impl = std::make_shared<
245
1.40k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1.40k
            } else {
247
1.40k
                cast_impl = std::make_shared<
248
1.40k
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1.40k
            }
250
1.40k
            return true;
251
1.40k
        } else {
252
1.40k
            return false;
253
1.40k
        }
254
1.40k
    };
255
256
1.40k
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) {
257
0
        return create_unsupport_wrapper(
258
0
                fmt::format("CAST AS number not supported {}", from_type->get_name()));
259
0
    }
260
261
1.40k
    return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
262
1.40k
                       uint32_t result, size_t input_rows_count,
263
1.40k
                       const NullMap::value_type* null_map = nullptr) {
264
1.40k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
1.40k
                                       null_map);
266
1.40k
    };
267
1.40k
}
_ZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE
Line
Count
Source
236
1.26k
WrapperType create_int_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
237
1.26k
    std::shared_ptr<CastToBase> cast_impl;
238
239
1.26k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
1.26k
        using Types = std::decay_t<decltype(types)>;
241
1.26k
        using FromDataType = typename Types::LeftType;
242
1.26k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
1.26k
            if (context->enable_strict_mode()) {
244
1.26k
                cast_impl = std::make_shared<
245
1.26k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1.26k
            } else {
247
1.26k
                cast_impl = std::make_shared<
248
1.26k
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1.26k
            }
250
1.26k
            return true;
251
1.26k
        } else {
252
1.26k
            return false;
253
1.26k
        }
254
1.26k
    };
255
256
1.26k
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) {
257
0
        return create_unsupport_wrapper(
258
0
                fmt::format("CAST AS number not supported {}", from_type->get_name()));
259
0
    }
260
261
1.26k
    return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
262
1.26k
                       uint32_t result, size_t input_rows_count,
263
1.26k
                       const NullMap::value_type* null_map = nullptr) {
264
1.26k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
1.26k
                                       null_map);
266
1.26k
    };
267
1.26k
}
_ZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE
Line
Count
Source
236
1.02k
WrapperType create_int_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
237
1.02k
    std::shared_ptr<CastToBase> cast_impl;
238
239
1.02k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
1.02k
        using Types = std::decay_t<decltype(types)>;
241
1.02k
        using FromDataType = typename Types::LeftType;
242
1.02k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
1.02k
            if (context->enable_strict_mode()) {
244
1.02k
                cast_impl = std::make_shared<
245
1.02k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1.02k
            } else {
247
1.02k
                cast_impl = std::make_shared<
248
1.02k
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1.02k
            }
250
1.02k
            return true;
251
1.02k
        } else {
252
1.02k
            return false;
253
1.02k
        }
254
1.02k
    };
255
256
1.02k
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) {
257
0
        return create_unsupport_wrapper(
258
0
                fmt::format("CAST AS number not supported {}", from_type->get_name()));
259
0
    }
260
261
1.02k
    return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
262
1.02k
                       uint32_t result, size_t input_rows_count,
263
1.02k
                       const NullMap::value_type* null_map = nullptr) {
264
1.02k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
1.02k
                                       null_map);
266
1.02k
    };
267
1.02k
}
_ZN5doris11CastWrapper18create_int_wrapperINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEEESt8functionIFNS_6StatusEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKhEES8_RKSt10shared_ptrIKNS_9IDataTypeEE
Line
Count
Source
236
1.11k
WrapperType create_int_wrapper(FunctionContext* context, const DataTypePtr& from_type) {
237
1.11k
    std::shared_ptr<CastToBase> cast_impl;
238
239
1.11k
    auto make_cast_wrapper = [&](const auto& types) -> bool {
240
1.11k
        using Types = std::decay_t<decltype(types)>;
241
1.11k
        using FromDataType = typename Types::LeftType;
242
1.11k
        if constexpr (type_allow_cast_to_basic_number<FromDataType>) {
243
1.11k
            if (context->enable_strict_mode()) {
244
1.11k
                cast_impl = std::make_shared<
245
1.11k
                        CastToImpl<CastModeType::StrictMode, FromDataType, ToDataType>>();
246
1.11k
            } else {
247
1.11k
                cast_impl = std::make_shared<
248
1.11k
                        CastToImpl<CastModeType::NonStrictMode, FromDataType, ToDataType>>();
249
1.11k
            }
250
1.11k
            return true;
251
1.11k
        } else {
252
1.11k
            return false;
253
1.11k
        }
254
1.11k
    };
255
256
1.11k
    if (!call_on_index_and_data_type<void>(from_type->get_primitive_type(), make_cast_wrapper)) {
257
0
        return create_unsupport_wrapper(
258
0
                fmt::format("CAST AS number not supported {}", from_type->get_name()));
259
0
    }
260
261
1.11k
    return [cast_impl](FunctionContext* context, Block& block, const ColumnNumbers& arguments,
262
1.11k
                       uint32_t result, size_t input_rows_count,
263
1.11k
                       const NullMap::value_type* null_map = nullptr) {
264
1.11k
        return cast_impl->execute_impl(context, block, arguments, result, input_rows_count,
265
1.11k
                                       null_map);
266
1.11k
    };
267
1.11k
}
268
} // namespace CastWrapper
269
#include "common/compile_check_end.h"
270
} // namespace doris