be/src/exprs/function/function_encryption.cpp
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #include <algorithm> |
19 | | #include <cstddef> |
20 | | #include <cstdint> |
21 | | #include <memory> |
22 | | #include <string> |
23 | | #include <string_view> |
24 | | #include <utility> |
25 | | #include <vector> |
26 | | |
27 | | #include "common/cast_set.h" |
28 | | #include "common/status.h" |
29 | | #include "core/assert_cast.h" |
30 | | #include "core/block/block.h" |
31 | | #include "core/column/column.h" |
32 | | #include "core/column/column_nullable.h" |
33 | | #include "core/column/column_string.h" |
34 | | #include "core/column/column_vector.h" |
35 | | #include "core/data_type/data_type.h" |
36 | | #include "core/data_type/data_type_nullable.h" |
37 | | #include "core/data_type/data_type_string.h" |
38 | | #include "core/string_ref.h" |
39 | | #include "exec/common/stringop_substring.h" |
40 | | #include "exec/common/util.hpp" |
41 | | #include "exprs/function/function.h" |
42 | | #include "exprs/function/simple_function_factory.h" |
43 | | #include "util/encryption_util.h" |
44 | | |
45 | | namespace doris { |
46 | | class FunctionContext; |
47 | | } // namespace doris |
48 | | |
49 | | namespace doris { |
50 | | |
51 | | inline StringCaseUnorderedMap<EncryptionMode> aes_mode_map { |
52 | | {"AES_128_ECB", EncryptionMode::AES_128_ECB}, |
53 | | {"AES_192_ECB", EncryptionMode::AES_192_ECB}, |
54 | | {"AES_256_ECB", EncryptionMode::AES_256_ECB}, |
55 | | {"AES_128_CBC", EncryptionMode::AES_128_CBC}, |
56 | | {"AES_192_CBC", EncryptionMode::AES_192_CBC}, |
57 | | {"AES_256_CBC", EncryptionMode::AES_256_CBC}, |
58 | | {"AES_128_CFB", EncryptionMode::AES_128_CFB}, |
59 | | {"AES_192_CFB", EncryptionMode::AES_192_CFB}, |
60 | | {"AES_256_CFB", EncryptionMode::AES_256_CFB}, |
61 | | {"AES_128_CFB1", EncryptionMode::AES_128_CFB1}, |
62 | | {"AES_192_CFB1", EncryptionMode::AES_192_CFB1}, |
63 | | {"AES_256_CFB1", EncryptionMode::AES_256_CFB1}, |
64 | | {"AES_128_CFB8", EncryptionMode::AES_128_CFB8}, |
65 | | {"AES_192_CFB8", EncryptionMode::AES_192_CFB8}, |
66 | | {"AES_256_CFB8", EncryptionMode::AES_256_CFB8}, |
67 | | {"AES_128_CFB128", EncryptionMode::AES_128_CFB128}, |
68 | | {"AES_192_CFB128", EncryptionMode::AES_192_CFB128}, |
69 | | {"AES_256_CFB128", EncryptionMode::AES_256_CFB128}, |
70 | | {"AES_128_CTR", EncryptionMode::AES_128_CTR}, |
71 | | {"AES_192_CTR", EncryptionMode::AES_192_CTR}, |
72 | | {"AES_256_CTR", EncryptionMode::AES_256_CTR}, |
73 | | {"AES_128_OFB", EncryptionMode::AES_128_OFB}, |
74 | | {"AES_192_OFB", EncryptionMode::AES_192_OFB}, |
75 | | {"AES_256_OFB", EncryptionMode::AES_256_OFB}, |
76 | | {"AES_128_GCM", EncryptionMode::AES_128_GCM}, |
77 | | {"AES_192_GCM", EncryptionMode::AES_192_GCM}, |
78 | | {"AES_256_GCM", EncryptionMode::AES_256_GCM}}; |
79 | | inline StringCaseUnorderedMap<EncryptionMode> sm4_mode_map { |
80 | | {"SM4_128_ECB", EncryptionMode::SM4_128_ECB}, |
81 | | {"SM4_128_CBC", EncryptionMode::SM4_128_CBC}, |
82 | | {"SM4_128_CFB128", EncryptionMode::SM4_128_CFB128}, |
83 | | {"SM4_128_OFB", EncryptionMode::SM4_128_OFB}, |
84 | | {"SM4_128_CTR", EncryptionMode::SM4_128_CTR}}; |
85 | | template <typename Impl, typename FunctionName> |
86 | | class FunctionEncryptionAndDecrypt : public IFunction { |
87 | | public: |
88 | | static constexpr auto name = FunctionName::name; |
89 | | |
90 | 10 | String get_name() const override { return name; }_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EEENS_14SM4EncryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 90 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EEENS_14SM4DecryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 90 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EEENS_14AESEncryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 90 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EEENS_14AESDecryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 90 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EEENS_14SM4EncryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 90 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EEENS_14SM4DecryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 90 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EEENS_14AESEncryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 90 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EEENS_14AESDecryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 90 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EEENS_14AESEncryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 90 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EEENS_14AESDecryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 90 | 1 | String get_name() const override { return name; } |
|
91 | | |
92 | 1.00k | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); }_ZN5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EEENS_14SM4EncryptNameEE6createEv Line | Count | Source | 92 | 9 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EEENS_14SM4DecryptNameEE6createEv Line | Count | Source | 92 | 9 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EEENS_14AESEncryptNameEE6createEv Line | Count | Source | 92 | 59 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EEENS_14AESDecryptNameEE6createEv Line | Count | Source | 92 | 52 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EEENS_14SM4EncryptNameEE6createEv Line | Count | Source | 92 | 271 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EEENS_14SM4DecryptNameEE6createEv Line | Count | Source | 92 | 242 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EEENS_14AESEncryptNameEE6createEv Line | Count | Source | 92 | 180 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EEENS_14AESDecryptNameEE6createEv Line | Count | Source | 92 | 160 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EEENS_14AESEncryptNameEE6createEv Line | Count | Source | 92 | 13 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EEENS_14AESDecryptNameEE6createEv Line | Count | Source | 92 | 13 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
|
93 | | |
94 | 918 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { |
95 | 918 | return make_nullable(std::make_shared<DataTypeString>()); |
96 | 918 | } Unexecuted instantiation: _ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EEENS_14SM4EncryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Unexecuted instantiation: _ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EEENS_14SM4DecryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE _ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EEENS_14AESEncryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 94 | 50 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 95 | 50 | return make_nullable(std::make_shared<DataTypeString>()); | 96 | 50 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EEENS_14AESDecryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 94 | 43 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 95 | 43 | return make_nullable(std::make_shared<DataTypeString>()); | 96 | 43 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EEENS_14SM4EncryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 94 | 262 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 95 | 262 | return make_nullable(std::make_shared<DataTypeString>()); | 96 | 262 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EEENS_14SM4DecryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 94 | 233 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 95 | 233 | return make_nullable(std::make_shared<DataTypeString>()); | 96 | 233 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EEENS_14AESEncryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 94 | 171 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 95 | 171 | return make_nullable(std::make_shared<DataTypeString>()); | 96 | 171 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EEENS_14AESDecryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 94 | 151 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 95 | 151 | return make_nullable(std::make_shared<DataTypeString>()); | 96 | 151 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EEENS_14AESEncryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 94 | 4 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 95 | 4 | return make_nullable(std::make_shared<DataTypeString>()); | 96 | 4 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EEENS_14AESDecryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 94 | 4 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 95 | 4 | return make_nullable(std::make_shared<DataTypeString>()); | 96 | 4 | } |
|
97 | | |
98 | 998 | DataTypes get_variadic_argument_types_impl() const override { |
99 | 998 | return Impl::get_variadic_argument_types_impl(); |
100 | 998 | } _ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EEENS_14SM4EncryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 98 | 8 | DataTypes get_variadic_argument_types_impl() const override { | 99 | 8 | return Impl::get_variadic_argument_types_impl(); | 100 | 8 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EEENS_14SM4DecryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 98 | 8 | DataTypes get_variadic_argument_types_impl() const override { | 99 | 8 | return Impl::get_variadic_argument_types_impl(); | 100 | 8 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EEENS_14AESEncryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 98 | 58 | DataTypes get_variadic_argument_types_impl() const override { | 99 | 58 | return Impl::get_variadic_argument_types_impl(); | 100 | 58 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EEENS_14AESDecryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 98 | 51 | DataTypes get_variadic_argument_types_impl() const override { | 99 | 51 | return Impl::get_variadic_argument_types_impl(); | 100 | 51 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EEENS_14SM4EncryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 98 | 270 | DataTypes get_variadic_argument_types_impl() const override { | 99 | 270 | return Impl::get_variadic_argument_types_impl(); | 100 | 270 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EEENS_14SM4DecryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 98 | 241 | DataTypes get_variadic_argument_types_impl() const override { | 99 | 241 | return Impl::get_variadic_argument_types_impl(); | 100 | 241 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EEENS_14AESEncryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 98 | 179 | DataTypes get_variadic_argument_types_impl() const override { | 99 | 179 | return Impl::get_variadic_argument_types_impl(); | 100 | 179 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EEENS_14AESDecryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 98 | 159 | DataTypes get_variadic_argument_types_impl() const override { | 99 | 159 | return Impl::get_variadic_argument_types_impl(); | 100 | 159 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EEENS_14AESEncryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 98 | 12 | DataTypes get_variadic_argument_types_impl() const override { | 99 | 12 | return Impl::get_variadic_argument_types_impl(); | 100 | 12 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EEENS_14AESDecryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 98 | 12 | DataTypes get_variadic_argument_types_impl() const override { | 99 | 12 | return Impl::get_variadic_argument_types_impl(); | 100 | 12 | } |
|
101 | | |
102 | 918 | size_t get_number_of_arguments() const override { |
103 | 918 | return get_variadic_argument_types_impl().size(); |
104 | 918 | } Unexecuted instantiation: _ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EEENS_14SM4EncryptNameEE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EEENS_14SM4DecryptNameEE23get_number_of_argumentsEv _ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EEENS_14AESEncryptNameEE23get_number_of_argumentsEv Line | Count | Source | 102 | 50 | size_t get_number_of_arguments() const override { | 103 | 50 | return get_variadic_argument_types_impl().size(); | 104 | 50 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EEENS_14AESDecryptNameEE23get_number_of_argumentsEv Line | Count | Source | 102 | 43 | size_t get_number_of_arguments() const override { | 103 | 43 | return get_variadic_argument_types_impl().size(); | 104 | 43 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EEENS_14SM4EncryptNameEE23get_number_of_argumentsEv Line | Count | Source | 102 | 262 | size_t get_number_of_arguments() const override { | 103 | 262 | return get_variadic_argument_types_impl().size(); | 104 | 262 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EEENS_14SM4DecryptNameEE23get_number_of_argumentsEv Line | Count | Source | 102 | 233 | size_t get_number_of_arguments() const override { | 103 | 233 | return get_variadic_argument_types_impl().size(); | 104 | 233 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EEENS_14AESEncryptNameEE23get_number_of_argumentsEv Line | Count | Source | 102 | 171 | size_t get_number_of_arguments() const override { | 103 | 171 | return get_variadic_argument_types_impl().size(); | 104 | 171 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EEENS_14AESDecryptNameEE23get_number_of_argumentsEv Line | Count | Source | 102 | 151 | size_t get_number_of_arguments() const override { | 103 | 151 | return get_variadic_argument_types_impl().size(); | 104 | 151 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EEENS_14AESEncryptNameEE23get_number_of_argumentsEv Line | Count | Source | 102 | 4 | size_t get_number_of_arguments() const override { | 103 | 4 | return get_variadic_argument_types_impl().size(); | 104 | 4 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EEENS_14AESDecryptNameEE23get_number_of_argumentsEv Line | Count | Source | 102 | 4 | size_t get_number_of_arguments() const override { | 103 | 4 | return get_variadic_argument_types_impl().size(); | 104 | 4 | } |
|
105 | | |
106 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
107 | 957 | uint32_t result, size_t input_rows_count) const override { |
108 | 957 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); |
109 | 957 | } Unexecuted instantiation: _ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EEENS_14SM4EncryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Unexecuted instantiation: _ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EEENS_14SM4DecryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm _ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EEENS_14AESEncryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 107 | 43 | uint32_t result, size_t input_rows_count) const override { | 108 | 43 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 109 | 43 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EEENS_14AESDecryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 107 | 36 | uint32_t result, size_t input_rows_count) const override { | 108 | 36 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 109 | 36 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EEENS_14SM4EncryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 107 | 268 | uint32_t result, size_t input_rows_count) const override { | 108 | 268 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 109 | 268 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EEENS_14SM4DecryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 107 | 239 | uint32_t result, size_t input_rows_count) const override { | 108 | 239 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 109 | 239 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EEENS_14AESEncryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 107 | 192 | uint32_t result, size_t input_rows_count) const override { | 108 | 192 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 109 | 192 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EEENS_14AESDecryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 107 | 171 | uint32_t result, size_t input_rows_count) const override { | 108 | 171 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 109 | 171 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EEENS_14AESEncryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 107 | 4 | uint32_t result, size_t input_rows_count) const override { | 108 | 4 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 109 | 4 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EEENS_14AESDecryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 107 | 4 | uint32_t result, size_t input_rows_count) const override { | 108 | 4 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 109 | 4 | } |
|
110 | | }; |
111 | | |
112 | | template <typename Impl, bool is_encrypt> |
113 | | void execute_result_vector(std::vector<const ColumnString::Offsets*>& offsets_list, |
114 | | std::vector<const ColumnString::Chars*>& chars_list, size_t i, |
115 | | EncryptionMode& encryption_mode, const char* iv_raw, int iv_length, |
116 | | ColumnString::Chars& result_data, ColumnString::Offsets& result_offset, |
117 | 1.33k | NullMap& null_map, const char* aad, int aad_length) { |
118 | 1.33k | int src_size = (*offsets_list[0])[i] - (*offsets_list[0])[i - 1]; |
119 | 1.33k | const auto* src_raw = |
120 | 1.33k | reinterpret_cast<const char*>(&(*chars_list[0])[(*offsets_list[0])[i - 1]]); |
121 | 1.33k | int key_size = (*offsets_list[1])[i] - (*offsets_list[1])[i - 1]; |
122 | 1.33k | const auto* key_raw = |
123 | 1.33k | reinterpret_cast<const char*>(&(*chars_list[1])[(*offsets_list[1])[i - 1]]); |
124 | 1.33k | execute_result<Impl, is_encrypt>(src_raw, src_size, key_raw, key_size, i, encryption_mode, |
125 | 1.33k | iv_raw, iv_length, result_data, result_offset, null_map, aad, |
126 | 1.33k | aad_length); |
127 | 1.33k | } _ZN5doris21execute_result_vectorINS_11EncryptImplELb1EEEvRSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEESaIS9_EERS2_IPKNS3_IhLm4096ES6_Lm16ELm15EEESaISF_EEmRNS_14EncryptionModeEPKciRSD_RS7_SN_SM_i Line | Count | Source | 117 | 693 | NullMap& null_map, const char* aad, int aad_length) { | 118 | 693 | int src_size = (*offsets_list[0])[i] - (*offsets_list[0])[i - 1]; | 119 | 693 | const auto* src_raw = | 120 | 693 | reinterpret_cast<const char*>(&(*chars_list[0])[(*offsets_list[0])[i - 1]]); | 121 | 693 | int key_size = (*offsets_list[1])[i] - (*offsets_list[1])[i - 1]; | 122 | 693 | const auto* key_raw = | 123 | 693 | reinterpret_cast<const char*>(&(*chars_list[1])[(*offsets_list[1])[i - 1]]); | 124 | 693 | execute_result<Impl, is_encrypt>(src_raw, src_size, key_raw, key_size, i, encryption_mode, | 125 | 693 | iv_raw, iv_length, result_data, result_offset, null_map, aad, | 126 | 693 | aad_length); | 127 | 693 | } |
_ZN5doris21execute_result_vectorINS_11DecryptImplELb0EEEvRSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEESaIS9_EERS2_IPKNS3_IhLm4096ES6_Lm16ELm15EEESaISF_EEmRNS_14EncryptionModeEPKciRSD_RS7_SN_SM_i Line | Count | Source | 117 | 638 | NullMap& null_map, const char* aad, int aad_length) { | 118 | 638 | int src_size = (*offsets_list[0])[i] - (*offsets_list[0])[i - 1]; | 119 | 638 | const auto* src_raw = | 120 | 638 | reinterpret_cast<const char*>(&(*chars_list[0])[(*offsets_list[0])[i - 1]]); | 121 | 638 | int key_size = (*offsets_list[1])[i] - (*offsets_list[1])[i - 1]; | 122 | 638 | const auto* key_raw = | 123 | 638 | reinterpret_cast<const char*>(&(*chars_list[1])[(*offsets_list[1])[i - 1]]); | 124 | 638 | execute_result<Impl, is_encrypt>(src_raw, src_size, key_raw, key_size, i, encryption_mode, | 125 | 638 | iv_raw, iv_length, result_data, result_offset, null_map, aad, | 126 | 638 | aad_length); | 127 | 638 | } |
|
128 | | |
129 | | template <typename Impl, bool is_encrypt> |
130 | | void execute_result_const(const ColumnString::Offsets* offsets_column, |
131 | | const ColumnString::Chars* chars_column, StringRef key_arg, size_t i, |
132 | | EncryptionMode& encryption_mode, const char* iv_raw, size_t iv_length, |
133 | | ColumnString::Chars& result_data, ColumnString::Offsets& result_offset, |
134 | 98 | NullMap& null_map, const char* aad, size_t aad_length) { |
135 | 98 | int src_size = (*offsets_column)[i] - (*offsets_column)[i - 1]; |
136 | 98 | const auto* src_raw = reinterpret_cast<const char*>(&(*chars_column)[(*offsets_column)[i - 1]]); |
137 | 98 | execute_result<Impl, is_encrypt>(src_raw, src_size, key_arg.data, key_arg.size, i, |
138 | 98 | encryption_mode, iv_raw, iv_length, result_data, result_offset, |
139 | 98 | null_map, aad, aad_length); |
140 | 98 | } _ZN5doris20execute_result_constINS_11EncryptImplELb1EEEvPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEPKNS2_IhLm4096ES5_Lm16ELm15EEENS_9StringRefEmRNS_14EncryptionModeEPKcmRS9_RS6_SH_SG_m Line | Count | Source | 134 | 51 | NullMap& null_map, const char* aad, size_t aad_length) { | 135 | 51 | int src_size = (*offsets_column)[i] - (*offsets_column)[i - 1]; | 136 | 51 | const auto* src_raw = reinterpret_cast<const char*>(&(*chars_column)[(*offsets_column)[i - 1]]); | 137 | 51 | execute_result<Impl, is_encrypt>(src_raw, src_size, key_arg.data, key_arg.size, i, | 138 | 51 | encryption_mode, iv_raw, iv_length, result_data, result_offset, | 139 | 51 | null_map, aad, aad_length); | 140 | 51 | } |
_ZN5doris20execute_result_constINS_11DecryptImplELb0EEEvPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEPKNS2_IhLm4096ES5_Lm16ELm15EEENS_9StringRefEmRNS_14EncryptionModeEPKcmRS9_RS6_SH_SG_m Line | Count | Source | 134 | 47 | NullMap& null_map, const char* aad, size_t aad_length) { | 135 | 47 | int src_size = (*offsets_column)[i] - (*offsets_column)[i - 1]; | 136 | 47 | const auto* src_raw = reinterpret_cast<const char*>(&(*chars_column)[(*offsets_column)[i - 1]]); | 137 | 47 | execute_result<Impl, is_encrypt>(src_raw, src_size, key_arg.data, key_arg.size, i, | 138 | 47 | encryption_mode, iv_raw, iv_length, result_data, result_offset, | 139 | 47 | null_map, aad, aad_length); | 140 | 47 | } |
|
141 | | |
142 | | template <typename Impl, bool is_encrypt> |
143 | | void execute_result(const char* src_raw, size_t src_size, const char* key_raw, size_t key_size, |
144 | | size_t i, EncryptionMode& encryption_mode, const char* iv_raw, size_t iv_length, |
145 | | ColumnString::Chars& result_data, ColumnString::Offsets& result_offset, |
146 | 1.42k | NullMap& null_map, const char* aad, size_t aad_length) { |
147 | 1.42k | auto cipher_len = src_size; |
148 | 1.42k | if constexpr (is_encrypt) { |
149 | 744 | cipher_len += 16; |
150 | | // for output AEAD tag |
151 | 744 | if (EncryptionUtil::is_gcm_mode(encryption_mode)) { |
152 | 5 | cipher_len += EncryptionUtil::GCM_TAG_SIZE; |
153 | 5 | } |
154 | 744 | } |
155 | 1.42k | std::unique_ptr<char[]> p; |
156 | 1.42k | p.reset(new char[cipher_len]); |
157 | 1.42k | int ret_code = 0; |
158 | | |
159 | 1.42k | ret_code = Impl::execute_impl(encryption_mode, (unsigned char*)src_raw, src_size, |
160 | 1.42k | (unsigned char*)key_raw, key_size, iv_raw, iv_length, true, |
161 | 1.42k | (unsigned char*)p.get(), (unsigned char*)aad, aad_length); |
162 | | |
163 | 1.42k | if (ret_code < 0) { |
164 | 308 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
165 | 1.12k | } else { |
166 | 1.12k | StringOP::push_value_string(std::string_view(p.get(), ret_code), i, result_data, |
167 | 1.12k | result_offset); |
168 | 1.12k | } |
169 | 1.42k | } _ZN5doris14execute_resultINS_11EncryptImplELb1EEEvPKcmS3_mmRNS_14EncryptionModeES3_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERNS6_IjLm4096ES9_Lm16ELm15EEESB_S3_m Line | Count | Source | 146 | 744 | NullMap& null_map, const char* aad, size_t aad_length) { | 147 | 744 | auto cipher_len = src_size; | 148 | 744 | if constexpr (is_encrypt) { | 149 | 744 | cipher_len += 16; | 150 | | // for output AEAD tag | 151 | 744 | if (EncryptionUtil::is_gcm_mode(encryption_mode)) { | 152 | 5 | cipher_len += EncryptionUtil::GCM_TAG_SIZE; | 153 | 5 | } | 154 | 744 | } | 155 | 744 | std::unique_ptr<char[]> p; | 156 | 744 | p.reset(new char[cipher_len]); | 157 | 744 | int ret_code = 0; | 158 | | | 159 | 744 | ret_code = Impl::execute_impl(encryption_mode, (unsigned char*)src_raw, src_size, | 160 | 744 | (unsigned char*)key_raw, key_size, iv_raw, iv_length, true, | 161 | 744 | (unsigned char*)p.get(), (unsigned char*)aad, aad_length); | 162 | | | 163 | 744 | if (ret_code < 0) { | 164 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 165 | 744 | } else { | 166 | 744 | StringOP::push_value_string(std::string_view(p.get(), ret_code), i, result_data, | 167 | 744 | result_offset); | 168 | 744 | } | 169 | 744 | } |
_ZN5doris14execute_resultINS_11DecryptImplELb0EEEvPKcmS3_mmRNS_14EncryptionModeES3_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERNS6_IjLm4096ES9_Lm16ELm15EEESB_S3_m Line | Count | Source | 146 | 685 | NullMap& null_map, const char* aad, size_t aad_length) { | 147 | 685 | auto cipher_len = src_size; | 148 | | if constexpr (is_encrypt) { | 149 | | cipher_len += 16; | 150 | | // for output AEAD tag | 151 | | if (EncryptionUtil::is_gcm_mode(encryption_mode)) { | 152 | | cipher_len += EncryptionUtil::GCM_TAG_SIZE; | 153 | | } | 154 | | } | 155 | 685 | std::unique_ptr<char[]> p; | 156 | 685 | p.reset(new char[cipher_len]); | 157 | 685 | int ret_code = 0; | 158 | | | 159 | 685 | ret_code = Impl::execute_impl(encryption_mode, (unsigned char*)src_raw, src_size, | 160 | 685 | (unsigned char*)key_raw, key_size, iv_raw, iv_length, true, | 161 | 685 | (unsigned char*)p.get(), (unsigned char*)aad, aad_length); | 162 | | | 163 | 685 | if (ret_code < 0) { | 164 | 308 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 165 | 377 | } else { | 166 | 377 | StringOP::push_value_string(std::string_view(p.get(), ret_code), i, result_data, | 167 | 377 | result_offset); | 168 | 377 | } | 169 | 685 | } |
|
170 | | |
171 | | template <typename Impl, EncryptionMode mode, bool is_encrypt> |
172 | | struct EncryptionAndDecryptTwoImpl { |
173 | 125 | static DataTypes get_variadic_argument_types_impl() { |
174 | 125 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), |
175 | 125 | std::make_shared<DataTypeString>()}; |
176 | 125 | } _ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EE32get_variadic_argument_types_implEv Line | Count | Source | 173 | 8 | static DataTypes get_variadic_argument_types_impl() { | 174 | 8 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 175 | 8 | std::make_shared<DataTypeString>()}; | 176 | 8 | } |
_ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EE32get_variadic_argument_types_implEv Line | Count | Source | 173 | 8 | static DataTypes get_variadic_argument_types_impl() { | 174 | 8 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 175 | 8 | std::make_shared<DataTypeString>()}; | 176 | 8 | } |
_ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EE32get_variadic_argument_types_implEv Line | Count | Source | 173 | 58 | static DataTypes get_variadic_argument_types_impl() { | 174 | 58 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 175 | 58 | std::make_shared<DataTypeString>()}; | 176 | 58 | } |
_ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EE32get_variadic_argument_types_implEv Line | Count | Source | 173 | 51 | static DataTypes get_variadic_argument_types_impl() { | 174 | 51 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 175 | 51 | std::make_shared<DataTypeString>()}; | 176 | 51 | } |
|
177 | | |
178 | | static Status execute_impl_inner(FunctionContext* context, Block& block, |
179 | | const ColumnNumbers& arguments, uint32_t result, |
180 | 79 | size_t input_rows_count) { |
181 | 79 | auto result_column = ColumnString::create(); |
182 | 79 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); |
183 | 79 | DCHECK_EQ(3, arguments.size()); |
184 | 79 | const size_t argument_size = 3; |
185 | 79 | bool col_const[argument_size]; |
186 | 79 | ColumnPtr argument_columns[argument_size]; |
187 | 316 | for (int i = 0; i < argument_size; ++i) { |
188 | 237 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); |
189 | 237 | } |
190 | 79 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( |
191 | 33 | *block.get_by_position(arguments[0]).column) |
192 | 33 | .convert_to_full_column() |
193 | 79 | : block.get_by_position(arguments[0]).column; |
194 | | |
195 | 79 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2}, block, arguments); |
196 | | |
197 | 79 | auto& result_data = result_column->get_chars(); |
198 | 79 | auto& result_offset = result_column->get_offsets(); |
199 | 79 | result_offset.resize(input_rows_count); |
200 | | |
201 | 79 | if (col_const[1] && col_const[2]) { |
202 | 11 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), |
203 | 11 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), |
204 | 11 | input_rows_count, result_data, result_offset, |
205 | 11 | result_null_map_column->get_data()); |
206 | 68 | } else { |
207 | 68 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); |
208 | 68 | std::vector<const ColumnString::Chars*> chars_list(argument_size); |
209 | 272 | for (size_t i = 0; i < argument_size; ++i) { |
210 | 204 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); |
211 | 204 | offsets_list[i] = &col_str->get_offsets(); |
212 | 204 | chars_list[i] = &col_str->get_chars(); |
213 | 204 | } |
214 | 68 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, |
215 | 68 | result_null_map_column->get_data()); |
216 | 68 | } |
217 | 79 | block.get_by_position(result).column = |
218 | 79 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); |
219 | 79 | return Status::OK(); |
220 | 79 | } Unexecuted instantiation: _ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Unexecuted instantiation: _ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm _ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 180 | 43 | size_t input_rows_count) { | 181 | 43 | auto result_column = ColumnString::create(); | 182 | 43 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 183 | 43 | DCHECK_EQ(3, arguments.size()); | 184 | 43 | const size_t argument_size = 3; | 185 | 43 | bool col_const[argument_size]; | 186 | 43 | ColumnPtr argument_columns[argument_size]; | 187 | 172 | for (int i = 0; i < argument_size; ++i) { | 188 | 129 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 189 | 129 | } | 190 | 43 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 191 | 18 | *block.get_by_position(arguments[0]).column) | 192 | 18 | .convert_to_full_column() | 193 | 43 | : block.get_by_position(arguments[0]).column; | 194 | | | 195 | 43 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2}, block, arguments); | 196 | | | 197 | 43 | auto& result_data = result_column->get_chars(); | 198 | 43 | auto& result_offset = result_column->get_offsets(); | 199 | 43 | result_offset.resize(input_rows_count); | 200 | | | 201 | 43 | if (col_const[1] && col_const[2]) { | 202 | 6 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 203 | 6 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 204 | 6 | input_rows_count, result_data, result_offset, | 205 | 6 | result_null_map_column->get_data()); | 206 | 37 | } else { | 207 | 37 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 208 | 37 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 209 | 148 | for (size_t i = 0; i < argument_size; ++i) { | 210 | 111 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 211 | 111 | offsets_list[i] = &col_str->get_offsets(); | 212 | 111 | chars_list[i] = &col_str->get_chars(); | 213 | 111 | } | 214 | 37 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 215 | 37 | result_null_map_column->get_data()); | 216 | 37 | } | 217 | 43 | block.get_by_position(result).column = | 218 | 43 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 219 | 43 | return Status::OK(); | 220 | 43 | } |
_ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 180 | 36 | size_t input_rows_count) { | 181 | 36 | auto result_column = ColumnString::create(); | 182 | 36 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 183 | 36 | DCHECK_EQ(3, arguments.size()); | 184 | 36 | const size_t argument_size = 3; | 185 | 36 | bool col_const[argument_size]; | 186 | 36 | ColumnPtr argument_columns[argument_size]; | 187 | 144 | for (int i = 0; i < argument_size; ++i) { | 188 | 108 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 189 | 108 | } | 190 | 36 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 191 | 15 | *block.get_by_position(arguments[0]).column) | 192 | 15 | .convert_to_full_column() | 193 | 36 | : block.get_by_position(arguments[0]).column; | 194 | | | 195 | 36 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2}, block, arguments); | 196 | | | 197 | 36 | auto& result_data = result_column->get_chars(); | 198 | 36 | auto& result_offset = result_column->get_offsets(); | 199 | 36 | result_offset.resize(input_rows_count); | 200 | | | 201 | 36 | if (col_const[1] && col_const[2]) { | 202 | 5 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 203 | 5 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 204 | 5 | input_rows_count, result_data, result_offset, | 205 | 5 | result_null_map_column->get_data()); | 206 | 31 | } else { | 207 | 31 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 208 | 31 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 209 | 124 | for (size_t i = 0; i < argument_size; ++i) { | 210 | 93 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 211 | 93 | offsets_list[i] = &col_str->get_offsets(); | 212 | 93 | chars_list[i] = &col_str->get_chars(); | 213 | 93 | } | 214 | 31 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 215 | 31 | result_null_map_column->get_data()); | 216 | 31 | } | 217 | 36 | block.get_by_position(result).column = | 218 | 36 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 219 | 36 | return Status::OK(); | 220 | 36 | } |
|
221 | | |
222 | | static void vector_const(const ColumnString* column, StringRef key_arg, StringRef mode_arg, |
223 | | size_t input_rows_count, ColumnString::Chars& result_data, |
224 | 11 | ColumnString::Offsets& result_offset, NullMap& null_map) { |
225 | 11 | EncryptionMode encryption_mode = mode; |
226 | 11 | std::string mode_str(mode_arg.data, mode_arg.size); |
227 | 11 | bool all_insert_null = false; |
228 | 11 | if (mode_arg.size != 0) { |
229 | 11 | if (!aes_mode_map.contains(mode_str)) { |
230 | 0 | all_insert_null = true; |
231 | 11 | } else { |
232 | 11 | encryption_mode = aes_mode_map.at(mode_str); |
233 | 11 | } |
234 | 11 | } |
235 | 11 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); |
236 | 11 | const ColumnString::Chars* chars_column = &column->get_chars(); |
237 | 22 | for (int i = 0; i < input_rows_count; ++i) { |
238 | 11 | if (all_insert_null || null_map[i]) { |
239 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
240 | 0 | continue; |
241 | 0 | } |
242 | 11 | execute_result_const<Impl, is_encrypt>(offsets_column, chars_column, key_arg, i, |
243 | 11 | encryption_mode, nullptr, 0, result_data, |
244 | 11 | result_offset, null_map, nullptr, 0); |
245 | 11 | } |
246 | 11 | } Unexecuted instantiation: _ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_ Unexecuted instantiation: _ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_ _ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_ Line | Count | Source | 224 | 6 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 225 | 6 | EncryptionMode encryption_mode = mode; | 226 | 6 | std::string mode_str(mode_arg.data, mode_arg.size); | 227 | 6 | bool all_insert_null = false; | 228 | 6 | if (mode_arg.size != 0) { | 229 | 6 | if (!aes_mode_map.contains(mode_str)) { | 230 | 0 | all_insert_null = true; | 231 | 6 | } else { | 232 | 6 | encryption_mode = aes_mode_map.at(mode_str); | 233 | 6 | } | 234 | 6 | } | 235 | 6 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 236 | 6 | const ColumnString::Chars* chars_column = &column->get_chars(); | 237 | 12 | for (int i = 0; i < input_rows_count; ++i) { | 238 | 6 | if (all_insert_null || null_map[i]) { | 239 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 240 | 0 | continue; | 241 | 0 | } | 242 | 6 | execute_result_const<Impl, is_encrypt>(offsets_column, chars_column, key_arg, i, | 243 | 6 | encryption_mode, nullptr, 0, result_data, | 244 | 6 | result_offset, null_map, nullptr, 0); | 245 | 6 | } | 246 | 6 | } |
_ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_ Line | Count | Source | 224 | 5 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 225 | 5 | EncryptionMode encryption_mode = mode; | 226 | 5 | std::string mode_str(mode_arg.data, mode_arg.size); | 227 | 5 | bool all_insert_null = false; | 228 | 5 | if (mode_arg.size != 0) { | 229 | 5 | if (!aes_mode_map.contains(mode_str)) { | 230 | 0 | all_insert_null = true; | 231 | 5 | } else { | 232 | 5 | encryption_mode = aes_mode_map.at(mode_str); | 233 | 5 | } | 234 | 5 | } | 235 | 5 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 236 | 5 | const ColumnString::Chars* chars_column = &column->get_chars(); | 237 | 10 | for (int i = 0; i < input_rows_count; ++i) { | 238 | 5 | if (all_insert_null || null_map[i]) { | 239 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 240 | 0 | continue; | 241 | 0 | } | 242 | 5 | execute_result_const<Impl, is_encrypt>(offsets_column, chars_column, key_arg, i, | 243 | 5 | encryption_mode, nullptr, 0, result_data, | 244 | 5 | result_offset, null_map, nullptr, 0); | 245 | 5 | } | 246 | 5 | } |
|
247 | | |
248 | | static void vector_vector(std::vector<const ColumnString::Offsets*>& offsets_list, |
249 | | std::vector<const ColumnString::Chars*>& chars_list, |
250 | | size_t input_rows_count, ColumnString::Chars& result_data, |
251 | 68 | ColumnString::Offsets& result_offset, NullMap& null_map) { |
252 | 147 | for (int i = 0; i < input_rows_count; ++i) { |
253 | 79 | if (null_map[i]) { |
254 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
255 | 0 | continue; |
256 | 0 | } |
257 | 79 | EncryptionMode encryption_mode = mode; |
258 | 79 | int mode_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; |
259 | 79 | const auto* mode_raw = |
260 | 79 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); |
261 | 79 | if (mode_size != 0) { |
262 | 79 | std::string mode_str(mode_raw, mode_size); |
263 | 79 | if (aes_mode_map.count(mode_str) == 0) { |
264 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
265 | 0 | continue; |
266 | 0 | } |
267 | 79 | encryption_mode = aes_mode_map.at(mode_str); |
268 | 79 | } |
269 | 79 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, |
270 | 79 | nullptr, 0, result_data, result_offset, |
271 | 79 | null_map, nullptr, 0); |
272 | 79 | } |
273 | 68 | } Unexecuted instantiation: _ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Unexecuted instantiation: _ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ _ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 251 | 37 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 252 | 80 | for (int i = 0; i < input_rows_count; ++i) { | 253 | 43 | if (null_map[i]) { | 254 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 255 | 0 | continue; | 256 | 0 | } | 257 | 43 | EncryptionMode encryption_mode = mode; | 258 | 43 | int mode_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 259 | 43 | const auto* mode_raw = | 260 | 43 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 261 | 43 | if (mode_size != 0) { | 262 | 43 | std::string mode_str(mode_raw, mode_size); | 263 | 43 | if (aes_mode_map.count(mode_str) == 0) { | 264 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 265 | 0 | continue; | 266 | 0 | } | 267 | 43 | encryption_mode = aes_mode_map.at(mode_str); | 268 | 43 | } | 269 | 43 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 270 | 43 | nullptr, 0, result_data, result_offset, | 271 | 43 | null_map, nullptr, 0); | 272 | 43 | } | 273 | 37 | } |
_ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 251 | 31 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 252 | 67 | for (int i = 0; i < input_rows_count; ++i) { | 253 | 36 | if (null_map[i]) { | 254 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 255 | 0 | continue; | 256 | 0 | } | 257 | 36 | EncryptionMode encryption_mode = mode; | 258 | 36 | int mode_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 259 | 36 | const auto* mode_raw = | 260 | 36 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 261 | 36 | if (mode_size != 0) { | 262 | 36 | std::string mode_str(mode_raw, mode_size); | 263 | 36 | if (aes_mode_map.count(mode_str) == 0) { | 264 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 265 | 0 | continue; | 266 | 0 | } | 267 | 36 | encryption_mode = aes_mode_map.at(mode_str); | 268 | 36 | } | 269 | 36 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 270 | 36 | nullptr, 0, result_data, result_offset, | 271 | 36 | null_map, nullptr, 0); | 272 | 36 | } | 273 | 31 | } |
|
274 | | }; |
275 | | |
276 | | template <typename Impl, EncryptionMode mode, bool is_encrypt, bool is_sm_mode, int arg_num = 4> |
277 | | struct EncryptionAndDecryptMultiImpl { |
278 | 873 | static DataTypes get_variadic_argument_types_impl() { |
279 | 873 | if constexpr (arg_num == 5) { |
280 | 24 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), |
281 | 24 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), |
282 | 24 | std::make_shared<DataTypeString>()}; |
283 | 849 | } else { |
284 | 849 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), |
285 | 849 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; |
286 | 849 | } |
287 | 873 | } _ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EE32get_variadic_argument_types_implEv Line | Count | Source | 278 | 270 | static DataTypes get_variadic_argument_types_impl() { | 279 | | if constexpr (arg_num == 5) { | 280 | | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 281 | | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 282 | | std::make_shared<DataTypeString>()}; | 283 | 270 | } else { | 284 | 270 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 285 | 270 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; | 286 | 270 | } | 287 | 270 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EE32get_variadic_argument_types_implEv Line | Count | Source | 278 | 241 | static DataTypes get_variadic_argument_types_impl() { | 279 | | if constexpr (arg_num == 5) { | 280 | | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 281 | | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 282 | | std::make_shared<DataTypeString>()}; | 283 | 241 | } else { | 284 | 241 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 285 | 241 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; | 286 | 241 | } | 287 | 241 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EE32get_variadic_argument_types_implEv Line | Count | Source | 278 | 179 | static DataTypes get_variadic_argument_types_impl() { | 279 | | if constexpr (arg_num == 5) { | 280 | | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 281 | | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 282 | | std::make_shared<DataTypeString>()}; | 283 | 179 | } else { | 284 | 179 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 285 | 179 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; | 286 | 179 | } | 287 | 179 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EE32get_variadic_argument_types_implEv Line | Count | Source | 278 | 159 | static DataTypes get_variadic_argument_types_impl() { | 279 | | if constexpr (arg_num == 5) { | 280 | | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 281 | | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 282 | | std::make_shared<DataTypeString>()}; | 283 | 159 | } else { | 284 | 159 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 285 | 159 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; | 286 | 159 | } | 287 | 159 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EE32get_variadic_argument_types_implEv Line | Count | Source | 278 | 12 | static DataTypes get_variadic_argument_types_impl() { | 279 | 12 | if constexpr (arg_num == 5) { | 280 | 12 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 281 | 12 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 282 | 12 | std::make_shared<DataTypeString>()}; | 283 | | } else { | 284 | | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 285 | | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; | 286 | | } | 287 | 12 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EE32get_variadic_argument_types_implEv Line | Count | Source | 278 | 12 | static DataTypes get_variadic_argument_types_impl() { | 279 | 12 | if constexpr (arg_num == 5) { | 280 | 12 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 281 | 12 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 282 | 12 | std::make_shared<DataTypeString>()}; | 283 | | } else { | 284 | | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 285 | | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; | 286 | | } | 287 | 12 | } |
|
288 | | |
289 | | static Status execute_impl_inner(FunctionContext* context, Block& block, |
290 | | const ColumnNumbers& arguments, uint32_t result, |
291 | 877 | size_t input_rows_count) { |
292 | 877 | auto result_column = ColumnString::create(); |
293 | 877 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); |
294 | 877 | DCHECK_EQ(arguments.size(), arg_num); |
295 | 877 | const size_t argument_size = arg_num; |
296 | 877 | bool col_const[argument_size]; |
297 | 877 | ColumnPtr argument_columns[argument_size]; |
298 | 4.40k | for (int i = 0; i < argument_size; ++i) { |
299 | 3.52k | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); |
300 | 3.52k | } |
301 | 877 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( |
302 | 255 | *block.get_by_position(arguments[0]).column) |
303 | 255 | .convert_to_full_column() |
304 | 877 | : block.get_by_position(arguments[0]).column; |
305 | | |
306 | 877 | if constexpr (arg_num == 5) { |
307 | 8 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, |
308 | 8 | arguments); |
309 | 869 | } else { |
310 | 869 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, |
311 | 869 | arguments); |
312 | 869 | } |
313 | | |
314 | 877 | auto& result_data = result_column->get_chars(); |
315 | 877 | auto& result_offset = result_column->get_offsets(); |
316 | 877 | result_offset.resize(input_rows_count); |
317 | | |
318 | 877 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { |
319 | 2 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), |
320 | 2 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), |
321 | 2 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, |
322 | 2 | result_offset, result_null_map_column->get_data(), |
323 | 2 | argument_columns[4]->get_data_at(0)); |
324 | 875 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { |
325 | 68 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), |
326 | 68 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), |
327 | 68 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, |
328 | 68 | result_offset, result_null_map_column->get_data(), StringRef()); |
329 | 807 | } else { |
330 | 807 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); |
331 | 807 | std::vector<const ColumnString::Chars*> chars_list(argument_size); |
332 | 4.04k | for (size_t i = 0; i < argument_size; ++i) { |
333 | 3.24k | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); |
334 | 3.24k | offsets_list[i] = &col_str->get_offsets(); |
335 | 3.24k | chars_list[i] = &col_str->get_chars(); |
336 | 3.24k | } |
337 | 807 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, |
338 | 807 | result_null_map_column->get_data()); |
339 | 807 | } |
340 | 877 | block.get_by_position(result).column = |
341 | 877 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); |
342 | 877 | return Status::OK(); |
343 | 877 | } _ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 291 | 268 | size_t input_rows_count) { | 292 | 268 | auto result_column = ColumnString::create(); | 293 | 268 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 294 | 268 | DCHECK_EQ(arguments.size(), arg_num); | 295 | 268 | const size_t argument_size = arg_num; | 296 | 268 | bool col_const[argument_size]; | 297 | 268 | ColumnPtr argument_columns[argument_size]; | 298 | 1.34k | for (int i = 0; i < argument_size; ++i) { | 299 | 1.07k | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 300 | 1.07k | } | 301 | 268 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 302 | 94 | *block.get_by_position(arguments[0]).column) | 303 | 94 | .convert_to_full_column() | 304 | 268 | : block.get_by_position(arguments[0]).column; | 305 | | | 306 | | if constexpr (arg_num == 5) { | 307 | | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, | 308 | | arguments); | 309 | 268 | } else { | 310 | 268 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, | 311 | 268 | arguments); | 312 | 268 | } | 313 | | | 314 | 268 | auto& result_data = result_column->get_chars(); | 315 | 268 | auto& result_offset = result_column->get_offsets(); | 316 | 268 | result_offset.resize(input_rows_count); | 317 | | | 318 | 268 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { | 319 | 0 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 320 | 0 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 321 | 0 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 322 | 0 | result_offset, result_null_map_column->get_data(), | 323 | 0 | argument_columns[4]->get_data_at(0)); | 324 | 268 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { | 325 | 20 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 326 | 20 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 327 | 20 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 328 | 20 | result_offset, result_null_map_column->get_data(), StringRef()); | 329 | 248 | } else { | 330 | 248 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 331 | 248 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 332 | 1.24k | for (size_t i = 0; i < argument_size; ++i) { | 333 | 992 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 334 | 992 | offsets_list[i] = &col_str->get_offsets(); | 335 | 992 | chars_list[i] = &col_str->get_chars(); | 336 | 992 | } | 337 | 248 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 338 | 248 | result_null_map_column->get_data()); | 339 | 248 | } | 340 | 268 | block.get_by_position(result).column = | 341 | 268 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 342 | 268 | return Status::OK(); | 343 | 268 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 291 | 239 | size_t input_rows_count) { | 292 | 239 | auto result_column = ColumnString::create(); | 293 | 239 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 294 | 239 | DCHECK_EQ(arguments.size(), arg_num); | 295 | 239 | const size_t argument_size = arg_num; | 296 | 239 | bool col_const[argument_size]; | 297 | 239 | ColumnPtr argument_columns[argument_size]; | 298 | 1.19k | for (int i = 0; i < argument_size; ++i) { | 299 | 956 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 300 | 956 | } | 301 | 239 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 302 | 72 | *block.get_by_position(arguments[0]).column) | 303 | 72 | .convert_to_full_column() | 304 | 239 | : block.get_by_position(arguments[0]).column; | 305 | | | 306 | | if constexpr (arg_num == 5) { | 307 | | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, | 308 | | arguments); | 309 | 239 | } else { | 310 | 239 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, | 311 | 239 | arguments); | 312 | 239 | } | 313 | | | 314 | 239 | auto& result_data = result_column->get_chars(); | 315 | 239 | auto& result_offset = result_column->get_offsets(); | 316 | 239 | result_offset.resize(input_rows_count); | 317 | | | 318 | 239 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { | 319 | 0 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 320 | 0 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 321 | 0 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 322 | 0 | result_offset, result_null_map_column->get_data(), | 323 | 0 | argument_columns[4]->get_data_at(0)); | 324 | 239 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { | 325 | 17 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 326 | 17 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 327 | 17 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 328 | 17 | result_offset, result_null_map_column->get_data(), StringRef()); | 329 | 222 | } else { | 330 | 222 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 331 | 222 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 332 | 1.11k | for (size_t i = 0; i < argument_size; ++i) { | 333 | 888 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 334 | 888 | offsets_list[i] = &col_str->get_offsets(); | 335 | 888 | chars_list[i] = &col_str->get_chars(); | 336 | 888 | } | 337 | 222 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 338 | 222 | result_null_map_column->get_data()); | 339 | 222 | } | 340 | 239 | block.get_by_position(result).column = | 341 | 239 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 342 | 239 | return Status::OK(); | 343 | 239 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 291 | 191 | size_t input_rows_count) { | 292 | 191 | auto result_column = ColumnString::create(); | 293 | 191 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 294 | 191 | DCHECK_EQ(arguments.size(), arg_num); | 295 | 191 | const size_t argument_size = arg_num; | 296 | 191 | bool col_const[argument_size]; | 297 | 191 | ColumnPtr argument_columns[argument_size]; | 298 | 959 | for (int i = 0; i < argument_size; ++i) { | 299 | 768 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 300 | 768 | } | 301 | 191 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 302 | 52 | *block.get_by_position(arguments[0]).column) | 303 | 52 | .convert_to_full_column() | 304 | 191 | : block.get_by_position(arguments[0]).column; | 305 | | | 306 | | if constexpr (arg_num == 5) { | 307 | | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, | 308 | | arguments); | 309 | 191 | } else { | 310 | 191 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, | 311 | 191 | arguments); | 312 | 191 | } | 313 | | | 314 | 191 | auto& result_data = result_column->get_chars(); | 315 | 191 | auto& result_offset = result_column->get_offsets(); | 316 | 191 | result_offset.resize(input_rows_count); | 317 | | | 318 | 191 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { | 319 | 0 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 320 | 0 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 321 | 0 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 322 | 0 | result_offset, result_null_map_column->get_data(), | 323 | 0 | argument_columns[4]->get_data_at(0)); | 324 | 192 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { | 325 | 16 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 326 | 16 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 327 | 16 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 328 | 16 | result_offset, result_null_map_column->get_data(), StringRef()); | 329 | 175 | } else { | 330 | 175 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 331 | 175 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 332 | 879 | for (size_t i = 0; i < argument_size; ++i) { | 333 | 704 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 334 | 704 | offsets_list[i] = &col_str->get_offsets(); | 335 | 704 | chars_list[i] = &col_str->get_chars(); | 336 | 704 | } | 337 | 175 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 338 | 175 | result_null_map_column->get_data()); | 339 | 175 | } | 340 | 191 | block.get_by_position(result).column = | 341 | 191 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 342 | 191 | return Status::OK(); | 343 | 191 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 291 | 171 | size_t input_rows_count) { | 292 | 171 | auto result_column = ColumnString::create(); | 293 | 171 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 294 | 171 | DCHECK_EQ(arguments.size(), arg_num); | 295 | 171 | const size_t argument_size = arg_num; | 296 | 171 | bool col_const[argument_size]; | 297 | 171 | ColumnPtr argument_columns[argument_size]; | 298 | 859 | for (int i = 0; i < argument_size; ++i) { | 299 | 688 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 300 | 688 | } | 301 | 171 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 302 | 37 | *block.get_by_position(arguments[0]).column) | 303 | 37 | .convert_to_full_column() | 304 | 171 | : block.get_by_position(arguments[0]).column; | 305 | | | 306 | | if constexpr (arg_num == 5) { | 307 | | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, | 308 | | arguments); | 309 | 171 | } else { | 310 | 171 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, | 311 | 171 | arguments); | 312 | 171 | } | 313 | | | 314 | 171 | auto& result_data = result_column->get_chars(); | 315 | 171 | auto& result_offset = result_column->get_offsets(); | 316 | 171 | result_offset.resize(input_rows_count); | 317 | | | 318 | 171 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { | 319 | 0 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 320 | 0 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 321 | 0 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 322 | 0 | result_offset, result_null_map_column->get_data(), | 323 | 0 | argument_columns[4]->get_data_at(0)); | 324 | 172 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { | 325 | 15 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 326 | 15 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 327 | 15 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 328 | 15 | result_offset, result_null_map_column->get_data(), StringRef()); | 329 | 156 | } else { | 330 | 156 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 331 | 156 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 332 | 784 | for (size_t i = 0; i < argument_size; ++i) { | 333 | 628 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 334 | 628 | offsets_list[i] = &col_str->get_offsets(); | 335 | 628 | chars_list[i] = &col_str->get_chars(); | 336 | 628 | } | 337 | 156 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 338 | 156 | result_null_map_column->get_data()); | 339 | 156 | } | 340 | 171 | block.get_by_position(result).column = | 341 | 171 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 342 | 171 | return Status::OK(); | 343 | 171 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 291 | 4 | size_t input_rows_count) { | 292 | 4 | auto result_column = ColumnString::create(); | 293 | 4 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 294 | 4 | DCHECK_EQ(arguments.size(), arg_num); | 295 | 4 | const size_t argument_size = arg_num; | 296 | 4 | bool col_const[argument_size]; | 297 | 4 | ColumnPtr argument_columns[argument_size]; | 298 | 24 | for (int i = 0; i < argument_size; ++i) { | 299 | 20 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 300 | 20 | } | 301 | 4 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 302 | 0 | *block.get_by_position(arguments[0]).column) | 303 | 0 | .convert_to_full_column() | 304 | 4 | : block.get_by_position(arguments[0]).column; | 305 | | | 306 | 4 | if constexpr (arg_num == 5) { | 307 | 4 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, | 308 | 4 | arguments); | 309 | | } else { | 310 | | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, | 311 | | arguments); | 312 | | } | 313 | | | 314 | 4 | auto& result_data = result_column->get_chars(); | 315 | 4 | auto& result_offset = result_column->get_offsets(); | 316 | 4 | result_offset.resize(input_rows_count); | 317 | | | 318 | 4 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { | 319 | 1 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 320 | 1 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 321 | 1 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 322 | 1 | result_offset, result_null_map_column->get_data(), | 323 | 1 | argument_columns[4]->get_data_at(0)); | 324 | 3 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { | 325 | 0 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 326 | 0 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 327 | 0 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 328 | 0 | result_offset, result_null_map_column->get_data(), StringRef()); | 329 | 3 | } else { | 330 | 3 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 331 | 3 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 332 | 18 | for (size_t i = 0; i < argument_size; ++i) { | 333 | 15 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 334 | 15 | offsets_list[i] = &col_str->get_offsets(); | 335 | 15 | chars_list[i] = &col_str->get_chars(); | 336 | 15 | } | 337 | 3 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 338 | 3 | result_null_map_column->get_data()); | 339 | 3 | } | 340 | 4 | block.get_by_position(result).column = | 341 | 4 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 342 | 4 | return Status::OK(); | 343 | 4 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 291 | 4 | size_t input_rows_count) { | 292 | 4 | auto result_column = ColumnString::create(); | 293 | 4 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 294 | 4 | DCHECK_EQ(arguments.size(), arg_num); | 295 | 4 | const size_t argument_size = arg_num; | 296 | 4 | bool col_const[argument_size]; | 297 | 4 | ColumnPtr argument_columns[argument_size]; | 298 | 24 | for (int i = 0; i < argument_size; ++i) { | 299 | 20 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 300 | 20 | } | 301 | 4 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 302 | 0 | *block.get_by_position(arguments[0]).column) | 303 | 0 | .convert_to_full_column() | 304 | 4 | : block.get_by_position(arguments[0]).column; | 305 | | | 306 | 4 | if constexpr (arg_num == 5) { | 307 | 4 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, | 308 | 4 | arguments); | 309 | | } else { | 310 | | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, | 311 | | arguments); | 312 | | } | 313 | | | 314 | 4 | auto& result_data = result_column->get_chars(); | 315 | 4 | auto& result_offset = result_column->get_offsets(); | 316 | 4 | result_offset.resize(input_rows_count); | 317 | | | 318 | 4 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { | 319 | 1 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 320 | 1 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 321 | 1 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 322 | 1 | result_offset, result_null_map_column->get_data(), | 323 | 1 | argument_columns[4]->get_data_at(0)); | 324 | 3 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { | 325 | 0 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 326 | 0 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 327 | 0 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 328 | 0 | result_offset, result_null_map_column->get_data(), StringRef()); | 329 | 3 | } else { | 330 | 3 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 331 | 3 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 332 | 18 | for (size_t i = 0; i < argument_size; ++i) { | 333 | 15 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 334 | 15 | offsets_list[i] = &col_str->get_offsets(); | 335 | 15 | chars_list[i] = &col_str->get_chars(); | 336 | 15 | } | 337 | 3 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 338 | 3 | result_null_map_column->get_data()); | 339 | 3 | } | 340 | 4 | block.get_by_position(result).column = | 341 | 4 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 342 | 4 | return Status::OK(); | 343 | 4 | } |
|
344 | | |
345 | | static void vector_const(const ColumnString* column, StringRef key_arg, StringRef iv_arg, |
346 | | StringRef mode_arg, size_t input_rows_count, |
347 | | ColumnString::Chars& result_data, ColumnString::Offsets& result_offset, |
348 | 70 | NullMap& null_map, StringRef aad_arg) { |
349 | 70 | EncryptionMode encryption_mode = mode; |
350 | 70 | bool all_insert_null = false; |
351 | 70 | if (mode_arg.size != 0) { |
352 | 70 | std::string mode_str(mode_arg.data, mode_arg.size); |
353 | 70 | if constexpr (is_sm_mode) { |
354 | 37 | if (sm4_mode_map.count(mode_str) == 0) { |
355 | 1 | all_insert_null = true; |
356 | 36 | } else { |
357 | 36 | encryption_mode = sm4_mode_map.at(mode_str); |
358 | 36 | } |
359 | 37 | } else { |
360 | 33 | if (aes_mode_map.count(mode_str) == 0) { |
361 | 0 | all_insert_null = true; |
362 | 33 | } else { |
363 | 33 | encryption_mode = aes_mode_map.at(mode_str); |
364 | 33 | } |
365 | 33 | } |
366 | 70 | } |
367 | | |
368 | 70 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); |
369 | 70 | const ColumnString::Chars* chars_column = &column->get_chars(); |
370 | 158 | for (int i = 0; i < input_rows_count; ++i) { |
371 | 88 | if (all_insert_null || null_map[i]) { |
372 | 1 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
373 | 1 | continue; |
374 | 1 | } |
375 | 87 | execute_result_const<Impl, is_encrypt>( |
376 | 87 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, |
377 | 87 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); |
378 | 87 | } |
379 | 70 | } _ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_S8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_S8_ Line | Count | Source | 348 | 20 | NullMap& null_map, StringRef aad_arg) { | 349 | 20 | EncryptionMode encryption_mode = mode; | 350 | 20 | bool all_insert_null = false; | 351 | 20 | if (mode_arg.size != 0) { | 352 | 20 | std::string mode_str(mode_arg.data, mode_arg.size); | 353 | 20 | if constexpr (is_sm_mode) { | 354 | 20 | if (sm4_mode_map.count(mode_str) == 0) { | 355 | 0 | all_insert_null = true; | 356 | 20 | } else { | 357 | 20 | encryption_mode = sm4_mode_map.at(mode_str); | 358 | 20 | } | 359 | | } else { | 360 | | if (aes_mode_map.count(mode_str) == 0) { | 361 | | all_insert_null = true; | 362 | | } else { | 363 | | encryption_mode = aes_mode_map.at(mode_str); | 364 | | } | 365 | | } | 366 | 20 | } | 367 | | | 368 | 20 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 369 | 20 | const ColumnString::Chars* chars_column = &column->get_chars(); | 370 | 40 | for (int i = 0; i < input_rows_count; ++i) { | 371 | 20 | if (all_insert_null || null_map[i]) { | 372 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 373 | 0 | continue; | 374 | 0 | } | 375 | 20 | execute_result_const<Impl, is_encrypt>( | 376 | 20 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, | 377 | 20 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); | 378 | 20 | } | 379 | 20 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_S8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_S8_ Line | Count | Source | 348 | 17 | NullMap& null_map, StringRef aad_arg) { | 349 | 17 | EncryptionMode encryption_mode = mode; | 350 | 17 | bool all_insert_null = false; | 351 | 17 | if (mode_arg.size != 0) { | 352 | 17 | std::string mode_str(mode_arg.data, mode_arg.size); | 353 | 17 | if constexpr (is_sm_mode) { | 354 | 17 | if (sm4_mode_map.count(mode_str) == 0) { | 355 | 1 | all_insert_null = true; | 356 | 16 | } else { | 357 | 16 | encryption_mode = sm4_mode_map.at(mode_str); | 358 | 16 | } | 359 | | } else { | 360 | | if (aes_mode_map.count(mode_str) == 0) { | 361 | | all_insert_null = true; | 362 | | } else { | 363 | | encryption_mode = aes_mode_map.at(mode_str); | 364 | | } | 365 | | } | 366 | 17 | } | 367 | | | 368 | 17 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 369 | 17 | const ColumnString::Chars* chars_column = &column->get_chars(); | 370 | 34 | for (int i = 0; i < input_rows_count; ++i) { | 371 | 17 | if (all_insert_null || null_map[i]) { | 372 | 1 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 373 | 1 | continue; | 374 | 1 | } | 375 | 16 | execute_result_const<Impl, is_encrypt>( | 376 | 16 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, | 377 | 16 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); | 378 | 16 | } | 379 | 17 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_S8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_S8_ Line | Count | Source | 348 | 16 | NullMap& null_map, StringRef aad_arg) { | 349 | 16 | EncryptionMode encryption_mode = mode; | 350 | 16 | bool all_insert_null = false; | 351 | 16 | if (mode_arg.size != 0) { | 352 | 16 | std::string mode_str(mode_arg.data, mode_arg.size); | 353 | | if constexpr (is_sm_mode) { | 354 | | if (sm4_mode_map.count(mode_str) == 0) { | 355 | | all_insert_null = true; | 356 | | } else { | 357 | | encryption_mode = sm4_mode_map.at(mode_str); | 358 | | } | 359 | 16 | } else { | 360 | 16 | if (aes_mode_map.count(mode_str) == 0) { | 361 | 0 | all_insert_null = true; | 362 | 16 | } else { | 363 | 16 | encryption_mode = aes_mode_map.at(mode_str); | 364 | 16 | } | 365 | 16 | } | 366 | 16 | } | 367 | | | 368 | 16 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 369 | 16 | const ColumnString::Chars* chars_column = &column->get_chars(); | 370 | 40 | for (int i = 0; i < input_rows_count; ++i) { | 371 | 24 | if (all_insert_null || null_map[i]) { | 372 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 373 | 0 | continue; | 374 | 0 | } | 375 | 24 | execute_result_const<Impl, is_encrypt>( | 376 | 24 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, | 377 | 24 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); | 378 | 24 | } | 379 | 16 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_S8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_S8_ Line | Count | Source | 348 | 15 | NullMap& null_map, StringRef aad_arg) { | 349 | 15 | EncryptionMode encryption_mode = mode; | 350 | 15 | bool all_insert_null = false; | 351 | 15 | if (mode_arg.size != 0) { | 352 | 15 | std::string mode_str(mode_arg.data, mode_arg.size); | 353 | | if constexpr (is_sm_mode) { | 354 | | if (sm4_mode_map.count(mode_str) == 0) { | 355 | | all_insert_null = true; | 356 | | } else { | 357 | | encryption_mode = sm4_mode_map.at(mode_str); | 358 | | } | 359 | 15 | } else { | 360 | 15 | if (aes_mode_map.count(mode_str) == 0) { | 361 | 0 | all_insert_null = true; | 362 | 15 | } else { | 363 | 15 | encryption_mode = aes_mode_map.at(mode_str); | 364 | 15 | } | 365 | 15 | } | 366 | 15 | } | 367 | | | 368 | 15 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 369 | 15 | const ColumnString::Chars* chars_column = &column->get_chars(); | 370 | 40 | for (int i = 0; i < input_rows_count; ++i) { | 371 | 25 | if (all_insert_null || null_map[i]) { | 372 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 373 | 0 | continue; | 374 | 0 | } | 375 | 25 | execute_result_const<Impl, is_encrypt>( | 376 | 25 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, | 377 | 25 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); | 378 | 25 | } | 379 | 15 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_S8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_S8_ Line | Count | Source | 348 | 1 | NullMap& null_map, StringRef aad_arg) { | 349 | 1 | EncryptionMode encryption_mode = mode; | 350 | 1 | bool all_insert_null = false; | 351 | 1 | if (mode_arg.size != 0) { | 352 | 1 | std::string mode_str(mode_arg.data, mode_arg.size); | 353 | | if constexpr (is_sm_mode) { | 354 | | if (sm4_mode_map.count(mode_str) == 0) { | 355 | | all_insert_null = true; | 356 | | } else { | 357 | | encryption_mode = sm4_mode_map.at(mode_str); | 358 | | } | 359 | 1 | } else { | 360 | 1 | if (aes_mode_map.count(mode_str) == 0) { | 361 | 0 | all_insert_null = true; | 362 | 1 | } else { | 363 | 1 | encryption_mode = aes_mode_map.at(mode_str); | 364 | 1 | } | 365 | 1 | } | 366 | 1 | } | 367 | | | 368 | 1 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 369 | 1 | const ColumnString::Chars* chars_column = &column->get_chars(); | 370 | 2 | for (int i = 0; i < input_rows_count; ++i) { | 371 | 1 | if (all_insert_null || null_map[i]) { | 372 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 373 | 0 | continue; | 374 | 0 | } | 375 | 1 | execute_result_const<Impl, is_encrypt>( | 376 | 1 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, | 377 | 1 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); | 378 | 1 | } | 379 | 1 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_S8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_S8_ Line | Count | Source | 348 | 1 | NullMap& null_map, StringRef aad_arg) { | 349 | 1 | EncryptionMode encryption_mode = mode; | 350 | 1 | bool all_insert_null = false; | 351 | 1 | if (mode_arg.size != 0) { | 352 | 1 | std::string mode_str(mode_arg.data, mode_arg.size); | 353 | | if constexpr (is_sm_mode) { | 354 | | if (sm4_mode_map.count(mode_str) == 0) { | 355 | | all_insert_null = true; | 356 | | } else { | 357 | | encryption_mode = sm4_mode_map.at(mode_str); | 358 | | } | 359 | 1 | } else { | 360 | 1 | if (aes_mode_map.count(mode_str) == 0) { | 361 | 0 | all_insert_null = true; | 362 | 1 | } else { | 363 | 1 | encryption_mode = aes_mode_map.at(mode_str); | 364 | 1 | } | 365 | 1 | } | 366 | 1 | } | 367 | | | 368 | 1 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 369 | 1 | const ColumnString::Chars* chars_column = &column->get_chars(); | 370 | 2 | for (int i = 0; i < input_rows_count; ++i) { | 371 | 1 | if (all_insert_null || null_map[i]) { | 372 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 373 | 0 | continue; | 374 | 0 | } | 375 | 1 | execute_result_const<Impl, is_encrypt>( | 376 | 1 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, | 377 | 1 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); | 378 | 1 | } | 379 | 1 | } |
|
380 | | |
381 | | static void vector_vector(std::vector<const ColumnString::Offsets*>& offsets_list, |
382 | | std::vector<const ColumnString::Chars*>& chars_list, |
383 | | size_t input_rows_count, ColumnString::Chars& result_data, |
384 | 809 | ColumnString::Offsets& result_offset, NullMap& null_map) { |
385 | 2.06k | for (int i = 0; i < input_rows_count; ++i) { |
386 | 1.25k | if (null_map[i]) { |
387 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
388 | 0 | continue; |
389 | 0 | } |
390 | | |
391 | 1.25k | EncryptionMode encryption_mode = mode; |
392 | 1.25k | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; |
393 | 1.25k | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; |
394 | 1.25k | const auto* mode_raw = |
395 | 1.25k | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); |
396 | 1.25k | const auto* iv_raw = |
397 | 1.25k | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); |
398 | 1.25k | if (mode_size != 0) { |
399 | 1.25k | std::string mode_str(mode_raw, mode_size); |
400 | 1.25k | if constexpr (is_sm_mode) { |
401 | 696 | if (sm4_mode_map.count(mode_str) == 0) { |
402 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
403 | 0 | continue; |
404 | 0 | } |
405 | 696 | encryption_mode = sm4_mode_map.at(mode_str); |
406 | 696 | } else { |
407 | 556 | if (aes_mode_map.count(mode_str) == 0) { |
408 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
409 | 0 | continue; |
410 | 0 | } |
411 | 556 | encryption_mode = aes_mode_map.at(mode_str); |
412 | 556 | } |
413 | 1.25k | } |
414 | | |
415 | 0 | int aad_size = 0; |
416 | 1.25k | const char* aad = nullptr; |
417 | 1.25k | if constexpr (arg_num == 5) { |
418 | 8 | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; |
419 | 8 | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); |
420 | 8 | } |
421 | | |
422 | 1.25k | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, |
423 | 1.25k | iv_raw, iv_size, result_data, result_offset, |
424 | 1.25k | null_map, aad, aad_size); |
425 | 1.25k | } |
426 | 809 | } _ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 384 | 248 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 385 | 610 | for (int i = 0; i < input_rows_count; ++i) { | 386 | 362 | if (null_map[i]) { | 387 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 388 | 0 | continue; | 389 | 0 | } | 390 | | | 391 | 362 | EncryptionMode encryption_mode = mode; | 392 | 362 | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; | 393 | 362 | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 394 | 362 | const auto* mode_raw = | 395 | 362 | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); | 396 | 362 | const auto* iv_raw = | 397 | 362 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 398 | 362 | if (mode_size != 0) { | 399 | 362 | std::string mode_str(mode_raw, mode_size); | 400 | 362 | if constexpr (is_sm_mode) { | 401 | 362 | if (sm4_mode_map.count(mode_str) == 0) { | 402 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 403 | 0 | continue; | 404 | 0 | } | 405 | 362 | encryption_mode = sm4_mode_map.at(mode_str); | 406 | | } else { | 407 | | if (aes_mode_map.count(mode_str) == 0) { | 408 | | StringOP::push_null_string(i, result_data, result_offset, null_map); | 409 | | continue; | 410 | | } | 411 | | encryption_mode = aes_mode_map.at(mode_str); | 412 | | } | 413 | 362 | } | 414 | | | 415 | 0 | int aad_size = 0; | 416 | 362 | const char* aad = nullptr; | 417 | | if constexpr (arg_num == 5) { | 418 | | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; | 419 | | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); | 420 | | } | 421 | | | 422 | 362 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 423 | 362 | iv_raw, iv_size, result_data, result_offset, | 424 | 362 | null_map, aad, aad_size); | 425 | 362 | } | 426 | 248 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 384 | 222 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 385 | 556 | for (int i = 0; i < input_rows_count; ++i) { | 386 | 334 | if (null_map[i]) { | 387 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 388 | 0 | continue; | 389 | 0 | } | 390 | | | 391 | 334 | EncryptionMode encryption_mode = mode; | 392 | 334 | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; | 393 | 334 | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 394 | 334 | const auto* mode_raw = | 395 | 334 | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); | 396 | 334 | const auto* iv_raw = | 397 | 334 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 398 | 334 | if (mode_size != 0) { | 399 | 334 | std::string mode_str(mode_raw, mode_size); | 400 | 334 | if constexpr (is_sm_mode) { | 401 | 334 | if (sm4_mode_map.count(mode_str) == 0) { | 402 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 403 | 0 | continue; | 404 | 0 | } | 405 | 334 | encryption_mode = sm4_mode_map.at(mode_str); | 406 | | } else { | 407 | | if (aes_mode_map.count(mode_str) == 0) { | 408 | | StringOP::push_null_string(i, result_data, result_offset, null_map); | 409 | | continue; | 410 | | } | 411 | | encryption_mode = aes_mode_map.at(mode_str); | 412 | | } | 413 | 334 | } | 414 | | | 415 | 0 | int aad_size = 0; | 416 | 334 | const char* aad = nullptr; | 417 | | if constexpr (arg_num == 5) { | 418 | | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; | 419 | | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); | 420 | | } | 421 | | | 422 | 334 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 423 | 334 | iv_raw, iv_size, result_data, result_offset, | 424 | 334 | null_map, aad, aad_size); | 425 | 334 | } | 426 | 222 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 384 | 176 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 385 | 460 | for (int i = 0; i < input_rows_count; ++i) { | 386 | 284 | if (null_map[i]) { | 387 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 388 | 0 | continue; | 389 | 0 | } | 390 | | | 391 | 284 | EncryptionMode encryption_mode = mode; | 392 | 284 | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; | 393 | 284 | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 394 | 284 | const auto* mode_raw = | 395 | 284 | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); | 396 | 284 | const auto* iv_raw = | 397 | 284 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 398 | 284 | if (mode_size != 0) { | 399 | 284 | std::string mode_str(mode_raw, mode_size); | 400 | | if constexpr (is_sm_mode) { | 401 | | if (sm4_mode_map.count(mode_str) == 0) { | 402 | | StringOP::push_null_string(i, result_data, result_offset, null_map); | 403 | | continue; | 404 | | } | 405 | | encryption_mode = sm4_mode_map.at(mode_str); | 406 | 284 | } else { | 407 | 284 | if (aes_mode_map.count(mode_str) == 0) { | 408 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 409 | 0 | continue; | 410 | 0 | } | 411 | 284 | encryption_mode = aes_mode_map.at(mode_str); | 412 | 284 | } | 413 | 284 | } | 414 | | | 415 | 0 | int aad_size = 0; | 416 | 284 | const char* aad = nullptr; | 417 | | if constexpr (arg_num == 5) { | 418 | | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; | 419 | | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); | 420 | | } | 421 | | | 422 | 284 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 423 | 284 | iv_raw, iv_size, result_data, result_offset, | 424 | 284 | null_map, aad, aad_size); | 425 | 284 | } | 426 | 176 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 384 | 157 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 385 | 421 | for (int i = 0; i < input_rows_count; ++i) { | 386 | 264 | if (null_map[i]) { | 387 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 388 | 0 | continue; | 389 | 0 | } | 390 | | | 391 | 264 | EncryptionMode encryption_mode = mode; | 392 | 264 | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; | 393 | 264 | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 394 | 264 | const auto* mode_raw = | 395 | 264 | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); | 396 | 264 | const auto* iv_raw = | 397 | 264 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 398 | 264 | if (mode_size != 0) { | 399 | 264 | std::string mode_str(mode_raw, mode_size); | 400 | | if constexpr (is_sm_mode) { | 401 | | if (sm4_mode_map.count(mode_str) == 0) { | 402 | | StringOP::push_null_string(i, result_data, result_offset, null_map); | 403 | | continue; | 404 | | } | 405 | | encryption_mode = sm4_mode_map.at(mode_str); | 406 | 264 | } else { | 407 | 264 | if (aes_mode_map.count(mode_str) == 0) { | 408 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 409 | 0 | continue; | 410 | 0 | } | 411 | 264 | encryption_mode = aes_mode_map.at(mode_str); | 412 | 264 | } | 413 | 264 | } | 414 | | | 415 | 0 | int aad_size = 0; | 416 | 264 | const char* aad = nullptr; | 417 | | if constexpr (arg_num == 5) { | 418 | | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; | 419 | | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); | 420 | | } | 421 | | | 422 | 264 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 423 | 264 | iv_raw, iv_size, result_data, result_offset, | 424 | 264 | null_map, aad, aad_size); | 425 | 264 | } | 426 | 157 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 384 | 3 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 385 | 7 | for (int i = 0; i < input_rows_count; ++i) { | 386 | 4 | if (null_map[i]) { | 387 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 388 | 0 | continue; | 389 | 0 | } | 390 | | | 391 | 4 | EncryptionMode encryption_mode = mode; | 392 | 4 | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; | 393 | 4 | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 394 | 4 | const auto* mode_raw = | 395 | 4 | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); | 396 | 4 | const auto* iv_raw = | 397 | 4 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 398 | 4 | if (mode_size != 0) { | 399 | 4 | std::string mode_str(mode_raw, mode_size); | 400 | | if constexpr (is_sm_mode) { | 401 | | if (sm4_mode_map.count(mode_str) == 0) { | 402 | | StringOP::push_null_string(i, result_data, result_offset, null_map); | 403 | | continue; | 404 | | } | 405 | | encryption_mode = sm4_mode_map.at(mode_str); | 406 | 4 | } else { | 407 | 4 | if (aes_mode_map.count(mode_str) == 0) { | 408 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 409 | 0 | continue; | 410 | 0 | } | 411 | 4 | encryption_mode = aes_mode_map.at(mode_str); | 412 | 4 | } | 413 | 4 | } | 414 | | | 415 | 0 | int aad_size = 0; | 416 | 4 | const char* aad = nullptr; | 417 | 4 | if constexpr (arg_num == 5) { | 418 | 4 | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; | 419 | 4 | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); | 420 | 4 | } | 421 | | | 422 | 4 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 423 | 4 | iv_raw, iv_size, result_data, result_offset, | 424 | 4 | null_map, aad, aad_size); | 425 | 4 | } | 426 | 3 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 384 | 3 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 385 | 7 | for (int i = 0; i < input_rows_count; ++i) { | 386 | 4 | if (null_map[i]) { | 387 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 388 | 0 | continue; | 389 | 0 | } | 390 | | | 391 | 4 | EncryptionMode encryption_mode = mode; | 392 | 4 | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; | 393 | 4 | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 394 | 4 | const auto* mode_raw = | 395 | 4 | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); | 396 | 4 | const auto* iv_raw = | 397 | 4 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 398 | 4 | if (mode_size != 0) { | 399 | 4 | std::string mode_str(mode_raw, mode_size); | 400 | | if constexpr (is_sm_mode) { | 401 | | if (sm4_mode_map.count(mode_str) == 0) { | 402 | | StringOP::push_null_string(i, result_data, result_offset, null_map); | 403 | | continue; | 404 | | } | 405 | | encryption_mode = sm4_mode_map.at(mode_str); | 406 | 4 | } else { | 407 | 4 | if (aes_mode_map.count(mode_str) == 0) { | 408 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 409 | 0 | continue; | 410 | 0 | } | 411 | 4 | encryption_mode = aes_mode_map.at(mode_str); | 412 | 4 | } | 413 | 4 | } | 414 | | | 415 | 0 | int aad_size = 0; | 416 | 4 | const char* aad = nullptr; | 417 | 4 | if constexpr (arg_num == 5) { | 418 | 4 | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; | 419 | 4 | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); | 420 | 4 | } | 421 | | | 422 | 4 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 423 | 4 | iv_raw, iv_size, result_data, result_offset, | 424 | 4 | null_map, aad, aad_size); | 425 | 4 | } | 426 | 3 | } |
|
427 | | }; |
428 | | |
429 | | struct EncryptImpl { |
430 | | static int execute_impl(EncryptionMode mode, const unsigned char* source, size_t source_length, |
431 | | const unsigned char* key, size_t key_length, const char* iv, |
432 | | size_t iv_length, bool padding, unsigned char* encrypt, |
433 | 744 | const unsigned char* aad, size_t aad_length) { |
434 | | // now the openssl only support int, so here we need to cast size_t to uint32_t |
435 | 744 | return EncryptionUtil::encrypt(mode, source, cast_set<uint32_t>(source_length), key, |
436 | 744 | cast_set<uint32_t>(key_length), iv, cast_set<int>(iv_length), |
437 | 744 | true, encrypt, aad, cast_set<uint32_t>(aad_length)); |
438 | 744 | } |
439 | | }; |
440 | | |
441 | | struct DecryptImpl { |
442 | | static int execute_impl(EncryptionMode mode, const unsigned char* source, size_t source_length, |
443 | | const unsigned char* key, size_t key_length, const char* iv, |
444 | | size_t iv_length, bool padding, unsigned char* encrypt, |
445 | 685 | const unsigned char* aad, size_t aad_length) { |
446 | 685 | return EncryptionUtil::decrypt(mode, source, cast_set<uint32_t>(source_length), key, |
447 | 685 | cast_set<uint32_t>(key_length), iv, cast_set<int>(iv_length), |
448 | 685 | true, encrypt, aad, cast_set<uint32_t>(aad_length)); |
449 | 685 | } |
450 | | }; |
451 | | |
452 | | struct SM4EncryptName { |
453 | | static constexpr auto name = "sm4_encrypt"; |
454 | | }; |
455 | | |
456 | | struct SM4DecryptName { |
457 | | static constexpr auto name = "sm4_decrypt"; |
458 | | }; |
459 | | |
460 | | struct AESEncryptName { |
461 | | static constexpr auto name = "aes_encrypt"; |
462 | | }; |
463 | | |
464 | | struct AESDecryptName { |
465 | | static constexpr auto name = "aes_decrypt"; |
466 | | }; |
467 | | |
468 | 8 | void register_function_encryption(SimpleFunctionFactory& factory) { |
469 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
470 | 8 | EncryptionAndDecryptTwoImpl<EncryptImpl, EncryptionMode::SM4_128_ECB, true>, |
471 | 8 | SM4EncryptName>>(); |
472 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
473 | 8 | EncryptionAndDecryptTwoImpl<DecryptImpl, EncryptionMode::SM4_128_ECB, false>, |
474 | 8 | SM4DecryptName>>(); |
475 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
476 | 8 | EncryptionAndDecryptTwoImpl<EncryptImpl, EncryptionMode::AES_128_ECB, true>, |
477 | 8 | AESEncryptName>>(); |
478 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
479 | 8 | EncryptionAndDecryptTwoImpl<DecryptImpl, EncryptionMode::AES_128_ECB, false>, |
480 | 8 | AESDecryptName>>(); |
481 | | |
482 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
483 | 8 | EncryptionAndDecryptMultiImpl<EncryptImpl, EncryptionMode::SM4_128_ECB, true, true>, |
484 | 8 | SM4EncryptName>>(); |
485 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
486 | 8 | EncryptionAndDecryptMultiImpl<DecryptImpl, EncryptionMode::SM4_128_ECB, false, true>, |
487 | 8 | SM4DecryptName>>(); |
488 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
489 | 8 | EncryptionAndDecryptMultiImpl<EncryptImpl, EncryptionMode::AES_128_ECB, true, false>, |
490 | 8 | AESEncryptName>>(); |
491 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
492 | 8 | EncryptionAndDecryptMultiImpl<DecryptImpl, EncryptionMode::AES_128_ECB, false, false>, |
493 | 8 | AESDecryptName>>(); |
494 | | |
495 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
496 | 8 | EncryptionAndDecryptMultiImpl<EncryptImpl, EncryptionMode::AES_128_GCM, true, false, 5>, |
497 | 8 | AESEncryptName>>(); |
498 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
499 | 8 | EncryptionAndDecryptMultiImpl<DecryptImpl, EncryptionMode::AES_128_GCM, false, false, |
500 | 8 | 5>, |
501 | 8 | AESDecryptName>>(); |
502 | 8 | } |
503 | | |
504 | | } // namespace doris |