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 | | #include "common/compile_check_begin.h" |
47 | | class FunctionContext; |
48 | | } // namespace doris |
49 | | |
50 | | namespace doris { |
51 | | |
52 | | inline StringCaseUnorderedMap<EncryptionMode> aes_mode_map { |
53 | | {"AES_128_ECB", EncryptionMode::AES_128_ECB}, |
54 | | {"AES_192_ECB", EncryptionMode::AES_192_ECB}, |
55 | | {"AES_256_ECB", EncryptionMode::AES_256_ECB}, |
56 | | {"AES_128_CBC", EncryptionMode::AES_128_CBC}, |
57 | | {"AES_192_CBC", EncryptionMode::AES_192_CBC}, |
58 | | {"AES_256_CBC", EncryptionMode::AES_256_CBC}, |
59 | | {"AES_128_CFB", EncryptionMode::AES_128_CFB}, |
60 | | {"AES_192_CFB", EncryptionMode::AES_192_CFB}, |
61 | | {"AES_256_CFB", EncryptionMode::AES_256_CFB}, |
62 | | {"AES_128_CFB1", EncryptionMode::AES_128_CFB1}, |
63 | | {"AES_192_CFB1", EncryptionMode::AES_192_CFB1}, |
64 | | {"AES_256_CFB1", EncryptionMode::AES_256_CFB1}, |
65 | | {"AES_128_CFB8", EncryptionMode::AES_128_CFB8}, |
66 | | {"AES_192_CFB8", EncryptionMode::AES_192_CFB8}, |
67 | | {"AES_256_CFB8", EncryptionMode::AES_256_CFB8}, |
68 | | {"AES_128_CFB128", EncryptionMode::AES_128_CFB128}, |
69 | | {"AES_192_CFB128", EncryptionMode::AES_192_CFB128}, |
70 | | {"AES_256_CFB128", EncryptionMode::AES_256_CFB128}, |
71 | | {"AES_128_CTR", EncryptionMode::AES_128_CTR}, |
72 | | {"AES_192_CTR", EncryptionMode::AES_192_CTR}, |
73 | | {"AES_256_CTR", EncryptionMode::AES_256_CTR}, |
74 | | {"AES_128_OFB", EncryptionMode::AES_128_OFB}, |
75 | | {"AES_192_OFB", EncryptionMode::AES_192_OFB}, |
76 | | {"AES_256_OFB", EncryptionMode::AES_256_OFB}, |
77 | | {"AES_128_GCM", EncryptionMode::AES_128_GCM}, |
78 | | {"AES_192_GCM", EncryptionMode::AES_192_GCM}, |
79 | | {"AES_256_GCM", EncryptionMode::AES_256_GCM}}; |
80 | | inline StringCaseUnorderedMap<EncryptionMode> sm4_mode_map { |
81 | | {"SM4_128_ECB", EncryptionMode::SM4_128_ECB}, |
82 | | {"SM4_128_CBC", EncryptionMode::SM4_128_CBC}, |
83 | | {"SM4_128_CFB128", EncryptionMode::SM4_128_CFB128}, |
84 | | {"SM4_128_OFB", EncryptionMode::SM4_128_OFB}, |
85 | | {"SM4_128_CTR", EncryptionMode::SM4_128_CTR}}; |
86 | | template <typename Impl, typename FunctionName> |
87 | | class FunctionEncryptionAndDecrypt : public IFunction { |
88 | | public: |
89 | | static constexpr auto name = FunctionName::name; |
90 | | |
91 | 10 | String get_name() const override { return name; }_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EEENS_14SM4EncryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 91 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EEENS_14SM4DecryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 91 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EEENS_14AESEncryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 91 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EEENS_14AESDecryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 91 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EEENS_14SM4EncryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 91 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EEENS_14SM4DecryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 91 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EEENS_14AESEncryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 91 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EEENS_14AESDecryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 91 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EEENS_14AESEncryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 91 | 1 | String get_name() const override { return name; } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EEENS_14AESDecryptNameEE8get_nameB5cxx11Ev Line | Count | Source | 91 | 1 | String get_name() const override { return name; } |
|
92 | | |
93 | 1.02k | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); }_ZN5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EEENS_14SM4EncryptNameEE6createEv Line | Count | Source | 93 | 9 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EEENS_14SM4DecryptNameEE6createEv Line | Count | Source | 93 | 9 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EEENS_14AESEncryptNameEE6createEv Line | Count | Source | 93 | 59 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EEENS_14AESDecryptNameEE6createEv Line | Count | Source | 93 | 52 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EEENS_14SM4EncryptNameEE6createEv Line | Count | Source | 93 | 271 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EEENS_14SM4DecryptNameEE6createEv Line | Count | Source | 93 | 242 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EEENS_14AESEncryptNameEE6createEv Line | Count | Source | 93 | 189 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EEENS_14AESDecryptNameEE6createEv Line | Count | Source | 93 | 169 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EEENS_14AESEncryptNameEE6createEv Line | Count | Source | 93 | 13 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
_ZN5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EEENS_14AESDecryptNameEE6createEv Line | Count | Source | 93 | 13 | static FunctionPtr create() { return std::make_shared<FunctionEncryptionAndDecrypt>(); } |
|
94 | | |
95 | 936 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { |
96 | 936 | return make_nullable(std::make_shared<DataTypeString>()); |
97 | 936 | } 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 | 95 | 50 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 96 | 50 | return make_nullable(std::make_shared<DataTypeString>()); | 97 | 50 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EEENS_14AESDecryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 95 | 43 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 96 | 43 | return make_nullable(std::make_shared<DataTypeString>()); | 97 | 43 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EEENS_14SM4EncryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 95 | 262 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 96 | 262 | return make_nullable(std::make_shared<DataTypeString>()); | 97 | 262 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EEENS_14SM4DecryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 95 | 233 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 96 | 233 | return make_nullable(std::make_shared<DataTypeString>()); | 97 | 233 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EEENS_14AESEncryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 95 | 180 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 96 | 180 | return make_nullable(std::make_shared<DataTypeString>()); | 97 | 180 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EEENS_14AESDecryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 95 | 160 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 96 | 160 | return make_nullable(std::make_shared<DataTypeString>()); | 97 | 160 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EEENS_14AESEncryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 95 | 4 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 96 | 4 | return make_nullable(std::make_shared<DataTypeString>()); | 97 | 4 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EEENS_14AESDecryptNameEE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISB_EE Line | Count | Source | 95 | 4 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 96 | 4 | return make_nullable(std::make_shared<DataTypeString>()); | 97 | 4 | } |
|
98 | | |
99 | 1.01k | DataTypes get_variadic_argument_types_impl() const override { |
100 | 1.01k | return Impl::get_variadic_argument_types_impl(); |
101 | 1.01k | } _ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EEENS_14SM4EncryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 99 | 8 | DataTypes get_variadic_argument_types_impl() const override { | 100 | 8 | return Impl::get_variadic_argument_types_impl(); | 101 | 8 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EEENS_14SM4DecryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 99 | 8 | DataTypes get_variadic_argument_types_impl() const override { | 100 | 8 | return Impl::get_variadic_argument_types_impl(); | 101 | 8 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EEENS_14AESEncryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 99 | 58 | DataTypes get_variadic_argument_types_impl() const override { | 100 | 58 | return Impl::get_variadic_argument_types_impl(); | 101 | 58 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EEENS_14AESDecryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 99 | 51 | DataTypes get_variadic_argument_types_impl() const override { | 100 | 51 | return Impl::get_variadic_argument_types_impl(); | 101 | 51 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EEENS_14SM4EncryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 99 | 270 | DataTypes get_variadic_argument_types_impl() const override { | 100 | 270 | return Impl::get_variadic_argument_types_impl(); | 101 | 270 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EEENS_14SM4DecryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 99 | 241 | DataTypes get_variadic_argument_types_impl() const override { | 100 | 241 | return Impl::get_variadic_argument_types_impl(); | 101 | 241 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EEENS_14AESEncryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 99 | 188 | DataTypes get_variadic_argument_types_impl() const override { | 100 | 188 | return Impl::get_variadic_argument_types_impl(); | 101 | 188 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EEENS_14AESDecryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 99 | 168 | DataTypes get_variadic_argument_types_impl() const override { | 100 | 168 | return Impl::get_variadic_argument_types_impl(); | 101 | 168 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EEENS_14AESEncryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 99 | 12 | DataTypes get_variadic_argument_types_impl() const override { | 100 | 12 | return Impl::get_variadic_argument_types_impl(); | 101 | 12 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EEENS_14AESDecryptNameEE32get_variadic_argument_types_implEv Line | Count | Source | 99 | 12 | DataTypes get_variadic_argument_types_impl() const override { | 100 | 12 | return Impl::get_variadic_argument_types_impl(); | 101 | 12 | } |
|
102 | | |
103 | 936 | size_t get_number_of_arguments() const override { |
104 | 936 | return get_variadic_argument_types_impl().size(); |
105 | 936 | } 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 | 103 | 50 | size_t get_number_of_arguments() const override { | 104 | 50 | return get_variadic_argument_types_impl().size(); | 105 | 50 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EEENS_14AESDecryptNameEE23get_number_of_argumentsEv Line | Count | Source | 103 | 43 | size_t get_number_of_arguments() const override { | 104 | 43 | return get_variadic_argument_types_impl().size(); | 105 | 43 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EEENS_14SM4EncryptNameEE23get_number_of_argumentsEv Line | Count | Source | 103 | 262 | size_t get_number_of_arguments() const override { | 104 | 262 | return get_variadic_argument_types_impl().size(); | 105 | 262 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EEENS_14SM4DecryptNameEE23get_number_of_argumentsEv Line | Count | Source | 103 | 233 | size_t get_number_of_arguments() const override { | 104 | 233 | return get_variadic_argument_types_impl().size(); | 105 | 233 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EEENS_14AESEncryptNameEE23get_number_of_argumentsEv Line | Count | Source | 103 | 180 | size_t get_number_of_arguments() const override { | 104 | 180 | return get_variadic_argument_types_impl().size(); | 105 | 180 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EEENS_14AESDecryptNameEE23get_number_of_argumentsEv Line | Count | Source | 103 | 160 | size_t get_number_of_arguments() const override { | 104 | 160 | return get_variadic_argument_types_impl().size(); | 105 | 160 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EEENS_14AESEncryptNameEE23get_number_of_argumentsEv Line | Count | Source | 103 | 4 | size_t get_number_of_arguments() const override { | 104 | 4 | return get_variadic_argument_types_impl().size(); | 105 | 4 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EEENS_14AESDecryptNameEE23get_number_of_argumentsEv Line | Count | Source | 103 | 4 | size_t get_number_of_arguments() const override { | 104 | 4 | return get_variadic_argument_types_impl().size(); | 105 | 4 | } |
|
106 | | |
107 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
108 | 976 | uint32_t result, size_t input_rows_count) const override { |
109 | 976 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); |
110 | 976 | } 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 | 108 | 43 | uint32_t result, size_t input_rows_count) const override { | 109 | 43 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 110 | 43 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EEENS_14AESDecryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 108 | 36 | uint32_t result, size_t input_rows_count) const override { | 109 | 36 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 110 | 36 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EEENS_14SM4EncryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 108 | 268 | uint32_t result, size_t input_rows_count) const override { | 109 | 268 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 110 | 268 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EEENS_14SM4DecryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 108 | 239 | uint32_t result, size_t input_rows_count) const override { | 109 | 239 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 110 | 239 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EEENS_14AESEncryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 108 | 201 | uint32_t result, size_t input_rows_count) const override { | 109 | 201 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 110 | 201 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EEENS_14AESDecryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 108 | 181 | uint32_t result, size_t input_rows_count) const override { | 109 | 181 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 110 | 181 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EEENS_14AESEncryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 108 | 4 | uint32_t result, size_t input_rows_count) const override { | 109 | 4 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 110 | 4 | } |
_ZNK5doris28FunctionEncryptionAndDecryptINS_29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EEENS_14AESDecryptNameEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 108 | 4 | uint32_t result, size_t input_rows_count) const override { | 109 | 4 | return Impl::execute_impl_inner(context, block, arguments, result, input_rows_count); | 110 | 4 | } |
|
111 | | }; |
112 | | |
113 | | template <typename Impl, bool is_encrypt> |
114 | | void execute_result_vector(std::vector<const ColumnString::Offsets*>& offsets_list, |
115 | | std::vector<const ColumnString::Chars*>& chars_list, size_t i, |
116 | | EncryptionMode& encryption_mode, const char* iv_raw, int iv_length, |
117 | | ColumnString::Chars& result_data, ColumnString::Offsets& result_offset, |
118 | 1.34k | NullMap& null_map, const char* aad, int aad_length) { |
119 | 1.34k | int src_size = (*offsets_list[0])[i] - (*offsets_list[0])[i - 1]; |
120 | 1.34k | const auto* src_raw = |
121 | 1.34k | reinterpret_cast<const char*>(&(*chars_list[0])[(*offsets_list[0])[i - 1]]); |
122 | 1.34k | int key_size = (*offsets_list[1])[i] - (*offsets_list[1])[i - 1]; |
123 | 1.34k | const auto* key_raw = |
124 | 1.34k | reinterpret_cast<const char*>(&(*chars_list[1])[(*offsets_list[1])[i - 1]]); |
125 | 1.34k | execute_result<Impl, is_encrypt>(src_raw, src_size, key_raw, key_size, i, encryption_mode, |
126 | 1.34k | iv_raw, iv_length, result_data, result_offset, null_map, aad, |
127 | 1.34k | aad_length); |
128 | 1.34k | } _ZN5doris21execute_result_vectorINS_11EncryptImplELb1EEEvRSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEESaIS9_EERS2_IPKNS3_IhLm4096ES6_Lm16ELm15EEESaISF_EEmRNS_14EncryptionModeEPKciRSD_RS7_SN_SM_i Line | Count | Source | 118 | 700 | NullMap& null_map, const char* aad, int aad_length) { | 119 | 700 | int src_size = (*offsets_list[0])[i] - (*offsets_list[0])[i - 1]; | 120 | 700 | const auto* src_raw = | 121 | 700 | reinterpret_cast<const char*>(&(*chars_list[0])[(*offsets_list[0])[i - 1]]); | 122 | 700 | int key_size = (*offsets_list[1])[i] - (*offsets_list[1])[i - 1]; | 123 | 700 | const auto* key_raw = | 124 | 700 | reinterpret_cast<const char*>(&(*chars_list[1])[(*offsets_list[1])[i - 1]]); | 125 | 700 | execute_result<Impl, is_encrypt>(src_raw, src_size, key_raw, key_size, i, encryption_mode, | 126 | 700 | iv_raw, iv_length, result_data, result_offset, null_map, aad, | 127 | 700 | aad_length); | 128 | 700 | } |
_ZN5doris21execute_result_vectorINS_11DecryptImplELb0EEEvRSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEESaIS9_EERS2_IPKNS3_IhLm4096ES6_Lm16ELm15EEESaISF_EEmRNS_14EncryptionModeEPKciRSD_RS7_SN_SM_i Line | Count | Source | 118 | 647 | NullMap& null_map, const char* aad, int aad_length) { | 119 | 647 | int src_size = (*offsets_list[0])[i] - (*offsets_list[0])[i - 1]; | 120 | 647 | const auto* src_raw = | 121 | 647 | reinterpret_cast<const char*>(&(*chars_list[0])[(*offsets_list[0])[i - 1]]); | 122 | 647 | int key_size = (*offsets_list[1])[i] - (*offsets_list[1])[i - 1]; | 123 | 647 | const auto* key_raw = | 124 | 647 | reinterpret_cast<const char*>(&(*chars_list[1])[(*offsets_list[1])[i - 1]]); | 125 | 647 | execute_result<Impl, is_encrypt>(src_raw, src_size, key_raw, key_size, i, encryption_mode, | 126 | 647 | iv_raw, iv_length, result_data, result_offset, null_map, aad, | 127 | 647 | aad_length); | 128 | 647 | } |
|
129 | | |
130 | | template <typename Impl, bool is_encrypt> |
131 | | void execute_result_const(const ColumnString::Offsets* offsets_column, |
132 | | const ColumnString::Chars* chars_column, StringRef key_arg, size_t i, |
133 | | EncryptionMode& encryption_mode, const char* iv_raw, size_t iv_length, |
134 | | ColumnString::Chars& result_data, ColumnString::Offsets& result_offset, |
135 | 100 | NullMap& null_map, const char* aad, size_t aad_length) { |
136 | 100 | int src_size = (*offsets_column)[i] - (*offsets_column)[i - 1]; |
137 | 100 | const auto* src_raw = reinterpret_cast<const char*>(&(*chars_column)[(*offsets_column)[i - 1]]); |
138 | 100 | execute_result<Impl, is_encrypt>(src_raw, src_size, key_arg.data, key_arg.size, i, |
139 | 100 | encryption_mode, iv_raw, iv_length, result_data, result_offset, |
140 | 100 | null_map, aad, aad_length); |
141 | 100 | } _ZN5doris20execute_result_constINS_11EncryptImplELb1EEEvPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEEPKNS2_IhLm4096ES5_Lm16ELm15EEENS_9StringRefEmRNS_14EncryptionModeEPKcmRS9_RS6_SH_SG_m Line | Count | Source | 135 | 53 | NullMap& null_map, const char* aad, size_t aad_length) { | 136 | 53 | int src_size = (*offsets_column)[i] - (*offsets_column)[i - 1]; | 137 | 53 | const auto* src_raw = reinterpret_cast<const char*>(&(*chars_column)[(*offsets_column)[i - 1]]); | 138 | 53 | execute_result<Impl, is_encrypt>(src_raw, src_size, key_arg.data, key_arg.size, i, | 139 | 53 | encryption_mode, iv_raw, iv_length, result_data, result_offset, | 140 | 53 | null_map, aad, aad_length); | 141 | 53 | } |
_ZN5doris20execute_result_constINS_11DecryptImplELb0EEEvPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEEPKNS2_IhLm4096ES5_Lm16ELm15EEENS_9StringRefEmRNS_14EncryptionModeEPKcmRS9_RS6_SH_SG_m Line | Count | Source | 135 | 47 | NullMap& null_map, const char* aad, size_t aad_length) { | 136 | 47 | int src_size = (*offsets_column)[i] - (*offsets_column)[i - 1]; | 137 | 47 | const auto* src_raw = reinterpret_cast<const char*>(&(*chars_column)[(*offsets_column)[i - 1]]); | 138 | 47 | execute_result<Impl, is_encrypt>(src_raw, src_size, key_arg.data, key_arg.size, i, | 139 | 47 | encryption_mode, iv_raw, iv_length, result_data, result_offset, | 140 | 47 | null_map, aad, aad_length); | 141 | 47 | } |
|
142 | | |
143 | | template <typename Impl, bool is_encrypt> |
144 | | void execute_result(const char* src_raw, size_t src_size, const char* key_raw, size_t key_size, |
145 | | size_t i, EncryptionMode& encryption_mode, const char* iv_raw, size_t iv_length, |
146 | | ColumnString::Chars& result_data, ColumnString::Offsets& result_offset, |
147 | 1.44k | NullMap& null_map, const char* aad, size_t aad_length) { |
148 | 1.44k | auto cipher_len = src_size; |
149 | 1.44k | if constexpr (is_encrypt) { |
150 | 753 | cipher_len += 16; |
151 | | // for output AEAD tag |
152 | 753 | if (EncryptionUtil::is_gcm_mode(encryption_mode)) { |
153 | 5 | cipher_len += EncryptionUtil::GCM_TAG_SIZE; |
154 | 5 | } |
155 | 753 | } |
156 | 1.44k | std::unique_ptr<char[]> p; |
157 | 1.44k | p.reset(new char[cipher_len]); |
158 | 1.44k | int ret_code = 0; |
159 | | |
160 | 1.44k | ret_code = Impl::execute_impl(encryption_mode, (unsigned char*)src_raw, src_size, |
161 | 1.44k | (unsigned char*)key_raw, key_size, iv_raw, iv_length, true, |
162 | 1.44k | (unsigned char*)p.get(), (unsigned char*)aad, aad_length); |
163 | | |
164 | 1.44k | if (ret_code < 0) { |
165 | 312 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
166 | 1.13k | } else { |
167 | 1.13k | StringOP::push_value_string(std::string_view(p.get(), ret_code), i, result_data, |
168 | 1.13k | result_offset); |
169 | 1.13k | } |
170 | 1.44k | } _ZN5doris14execute_resultINS_11EncryptImplELb1EEEvPKcmS3_mmRNS_14EncryptionModeES3_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEERNS6_IjLm4096ES9_Lm16ELm15EEESB_S3_m Line | Count | Source | 147 | 753 | NullMap& null_map, const char* aad, size_t aad_length) { | 148 | 753 | auto cipher_len = src_size; | 149 | 753 | if constexpr (is_encrypt) { | 150 | 753 | cipher_len += 16; | 151 | | // for output AEAD tag | 152 | 753 | if (EncryptionUtil::is_gcm_mode(encryption_mode)) { | 153 | 5 | cipher_len += EncryptionUtil::GCM_TAG_SIZE; | 154 | 5 | } | 155 | 753 | } | 156 | 753 | std::unique_ptr<char[]> p; | 157 | 753 | p.reset(new char[cipher_len]); | 158 | 753 | int ret_code = 0; | 159 | | | 160 | 753 | ret_code = Impl::execute_impl(encryption_mode, (unsigned char*)src_raw, src_size, | 161 | 753 | (unsigned char*)key_raw, key_size, iv_raw, iv_length, true, | 162 | 753 | (unsigned char*)p.get(), (unsigned char*)aad, aad_length); | 163 | | | 164 | 753 | if (ret_code < 0) { | 165 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 166 | 753 | } else { | 167 | 753 | StringOP::push_value_string(std::string_view(p.get(), ret_code), i, result_data, | 168 | 753 | result_offset); | 169 | 753 | } | 170 | 753 | } |
_ZN5doris14execute_resultINS_11DecryptImplELb0EEEvPKcmS3_mmRNS_14EncryptionModeES3_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEERNS6_IjLm4096ES9_Lm16ELm15EEESB_S3_m Line | Count | Source | 147 | 694 | NullMap& null_map, const char* aad, size_t aad_length) { | 148 | 694 | auto cipher_len = src_size; | 149 | | if constexpr (is_encrypt) { | 150 | | cipher_len += 16; | 151 | | // for output AEAD tag | 152 | | if (EncryptionUtil::is_gcm_mode(encryption_mode)) { | 153 | | cipher_len += EncryptionUtil::GCM_TAG_SIZE; | 154 | | } | 155 | | } | 156 | 694 | std::unique_ptr<char[]> p; | 157 | 694 | p.reset(new char[cipher_len]); | 158 | 694 | int ret_code = 0; | 159 | | | 160 | 694 | ret_code = Impl::execute_impl(encryption_mode, (unsigned char*)src_raw, src_size, | 161 | 694 | (unsigned char*)key_raw, key_size, iv_raw, iv_length, true, | 162 | 694 | (unsigned char*)p.get(), (unsigned char*)aad, aad_length); | 163 | | | 164 | 694 | if (ret_code < 0) { | 165 | 312 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 166 | 382 | } else { | 167 | 382 | StringOP::push_value_string(std::string_view(p.get(), ret_code), i, result_data, | 168 | 382 | result_offset); | 169 | 382 | } | 170 | 694 | } |
|
171 | | |
172 | | template <typename Impl, EncryptionMode mode, bool is_encrypt> |
173 | | struct EncryptionAndDecryptTwoImpl { |
174 | 125 | static DataTypes get_variadic_argument_types_impl() { |
175 | 125 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), |
176 | 125 | std::make_shared<DataTypeString>()}; |
177 | 125 | } _ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EE32get_variadic_argument_types_implEv Line | Count | Source | 174 | 8 | static DataTypes get_variadic_argument_types_impl() { | 175 | 8 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 176 | 8 | std::make_shared<DataTypeString>()}; | 177 | 8 | } |
_ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EE32get_variadic_argument_types_implEv Line | Count | Source | 174 | 8 | static DataTypes get_variadic_argument_types_impl() { | 175 | 8 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 176 | 8 | std::make_shared<DataTypeString>()}; | 177 | 8 | } |
_ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EE32get_variadic_argument_types_implEv Line | Count | Source | 174 | 58 | static DataTypes get_variadic_argument_types_impl() { | 175 | 58 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 176 | 58 | std::make_shared<DataTypeString>()}; | 177 | 58 | } |
_ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EE32get_variadic_argument_types_implEv Line | Count | Source | 174 | 51 | static DataTypes get_variadic_argument_types_impl() { | 175 | 51 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 176 | 51 | std::make_shared<DataTypeString>()}; | 177 | 51 | } |
|
178 | | |
179 | | static Status execute_impl_inner(FunctionContext* context, Block& block, |
180 | | const ColumnNumbers& arguments, uint32_t result, |
181 | 79 | size_t input_rows_count) { |
182 | 79 | auto result_column = ColumnString::create(); |
183 | 79 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); |
184 | 79 | DCHECK_EQ(3, arguments.size()); |
185 | 79 | const size_t argument_size = 3; |
186 | 79 | bool col_const[argument_size]; |
187 | 79 | ColumnPtr argument_columns[argument_size]; |
188 | 316 | for (int i = 0; i < argument_size; ++i) { |
189 | 237 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); |
190 | 237 | } |
191 | 79 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( |
192 | 33 | *block.get_by_position(arguments[0]).column) |
193 | 33 | .convert_to_full_column() |
194 | 79 | : block.get_by_position(arguments[0]).column; |
195 | | |
196 | 79 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2}, block, arguments); |
197 | | |
198 | 79 | auto& result_data = result_column->get_chars(); |
199 | 79 | auto& result_offset = result_column->get_offsets(); |
200 | 79 | result_offset.resize(input_rows_count); |
201 | | |
202 | 79 | if (col_const[1] && col_const[2]) { |
203 | 11 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), |
204 | 11 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), |
205 | 11 | input_rows_count, result_data, result_offset, |
206 | 11 | result_null_map_column->get_data()); |
207 | 68 | } else { |
208 | 68 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); |
209 | 68 | std::vector<const ColumnString::Chars*> chars_list(argument_size); |
210 | 272 | for (size_t i = 0; i < argument_size; ++i) { |
211 | 204 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); |
212 | 204 | offsets_list[i] = &col_str->get_offsets(); |
213 | 204 | chars_list[i] = &col_str->get_chars(); |
214 | 204 | } |
215 | 68 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, |
216 | 68 | result_null_map_column->get_data()); |
217 | 68 | } |
218 | 79 | block.get_by_position(result).column = |
219 | 79 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); |
220 | 79 | return Status::OK(); |
221 | 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 | 181 | 43 | size_t input_rows_count) { | 182 | 43 | auto result_column = ColumnString::create(); | 183 | 43 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 184 | 43 | DCHECK_EQ(3, arguments.size()); | 185 | 43 | const size_t argument_size = 3; | 186 | 43 | bool col_const[argument_size]; | 187 | 43 | ColumnPtr argument_columns[argument_size]; | 188 | 172 | for (int i = 0; i < argument_size; ++i) { | 189 | 129 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 190 | 129 | } | 191 | 43 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 192 | 18 | *block.get_by_position(arguments[0]).column) | 193 | 18 | .convert_to_full_column() | 194 | 43 | : block.get_by_position(arguments[0]).column; | 195 | | | 196 | 43 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2}, block, arguments); | 197 | | | 198 | 43 | auto& result_data = result_column->get_chars(); | 199 | 43 | auto& result_offset = result_column->get_offsets(); | 200 | 43 | result_offset.resize(input_rows_count); | 201 | | | 202 | 43 | if (col_const[1] && col_const[2]) { | 203 | 6 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 204 | 6 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 205 | 6 | input_rows_count, result_data, result_offset, | 206 | 6 | result_null_map_column->get_data()); | 207 | 37 | } else { | 208 | 37 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 209 | 37 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 210 | 148 | for (size_t i = 0; i < argument_size; ++i) { | 211 | 111 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 212 | 111 | offsets_list[i] = &col_str->get_offsets(); | 213 | 111 | chars_list[i] = &col_str->get_chars(); | 214 | 111 | } | 215 | 37 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 216 | 37 | result_null_map_column->get_data()); | 217 | 37 | } | 218 | 43 | block.get_by_position(result).column = | 219 | 43 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 220 | 43 | return Status::OK(); | 221 | 43 | } |
_ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 181 | 36 | size_t input_rows_count) { | 182 | 36 | auto result_column = ColumnString::create(); | 183 | 36 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 184 | 36 | DCHECK_EQ(3, arguments.size()); | 185 | 36 | const size_t argument_size = 3; | 186 | 36 | bool col_const[argument_size]; | 187 | 36 | ColumnPtr argument_columns[argument_size]; | 188 | 144 | for (int i = 0; i < argument_size; ++i) { | 189 | 108 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 190 | 108 | } | 191 | 36 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 192 | 15 | *block.get_by_position(arguments[0]).column) | 193 | 15 | .convert_to_full_column() | 194 | 36 | : block.get_by_position(arguments[0]).column; | 195 | | | 196 | 36 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2}, block, arguments); | 197 | | | 198 | 36 | auto& result_data = result_column->get_chars(); | 199 | 36 | auto& result_offset = result_column->get_offsets(); | 200 | 36 | result_offset.resize(input_rows_count); | 201 | | | 202 | 36 | if (col_const[1] && col_const[2]) { | 203 | 5 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 204 | 5 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 205 | 5 | input_rows_count, result_data, result_offset, | 206 | 5 | result_null_map_column->get_data()); | 207 | 31 | } else { | 208 | 31 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 209 | 31 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 210 | 124 | for (size_t i = 0; i < argument_size; ++i) { | 211 | 93 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 212 | 93 | offsets_list[i] = &col_str->get_offsets(); | 213 | 93 | chars_list[i] = &col_str->get_chars(); | 214 | 93 | } | 215 | 31 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 216 | 31 | result_null_map_column->get_data()); | 217 | 31 | } | 218 | 36 | block.get_by_position(result).column = | 219 | 36 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 220 | 36 | return Status::OK(); | 221 | 36 | } |
|
222 | | |
223 | | static void vector_const(const ColumnString* column, StringRef key_arg, StringRef mode_arg, |
224 | | size_t input_rows_count, ColumnString::Chars& result_data, |
225 | 11 | ColumnString::Offsets& result_offset, NullMap& null_map) { |
226 | 11 | EncryptionMode encryption_mode = mode; |
227 | 11 | std::string mode_str(mode_arg.data, mode_arg.size); |
228 | 11 | bool all_insert_null = false; |
229 | 11 | if (mode_arg.size != 0) { |
230 | 11 | if (!aes_mode_map.contains(mode_str)) { |
231 | 0 | all_insert_null = true; |
232 | 11 | } else { |
233 | 11 | encryption_mode = aes_mode_map.at(mode_str); |
234 | 11 | } |
235 | 11 | } |
236 | 11 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); |
237 | 11 | const ColumnString::Chars* chars_column = &column->get_chars(); |
238 | 22 | for (int i = 0; i < input_rows_count; ++i) { |
239 | 11 | if (all_insert_null || null_map[i]) { |
240 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
241 | 0 | continue; |
242 | 0 | } |
243 | 11 | execute_result_const<Impl, is_encrypt>(offsets_column, chars_column, key_arg, i, |
244 | 11 | encryption_mode, nullptr, 0, result_data, |
245 | 11 | result_offset, null_map, nullptr, 0); |
246 | 11 | } |
247 | 11 | } Unexecuted instantiation: _ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_ Unexecuted instantiation: _ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_ _ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_ Line | Count | Source | 225 | 6 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 226 | 6 | EncryptionMode encryption_mode = mode; | 227 | 6 | std::string mode_str(mode_arg.data, mode_arg.size); | 228 | 6 | bool all_insert_null = false; | 229 | 6 | if (mode_arg.size != 0) { | 230 | 6 | if (!aes_mode_map.contains(mode_str)) { | 231 | 0 | all_insert_null = true; | 232 | 6 | } else { | 233 | 6 | encryption_mode = aes_mode_map.at(mode_str); | 234 | 6 | } | 235 | 6 | } | 236 | 6 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 237 | 6 | const ColumnString::Chars* chars_column = &column->get_chars(); | 238 | 12 | for (int i = 0; i < input_rows_count; ++i) { | 239 | 6 | if (all_insert_null || null_map[i]) { | 240 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 241 | 0 | continue; | 242 | 0 | } | 243 | 6 | execute_result_const<Impl, is_encrypt>(offsets_column, chars_column, key_arg, i, | 244 | 6 | encryption_mode, nullptr, 0, result_data, | 245 | 6 | result_offset, null_map, nullptr, 0); | 246 | 6 | } | 247 | 6 | } |
_ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_ Line | Count | Source | 225 | 5 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 226 | 5 | EncryptionMode encryption_mode = mode; | 227 | 5 | std::string mode_str(mode_arg.data, mode_arg.size); | 228 | 5 | bool all_insert_null = false; | 229 | 5 | if (mode_arg.size != 0) { | 230 | 5 | if (!aes_mode_map.contains(mode_str)) { | 231 | 0 | all_insert_null = true; | 232 | 5 | } else { | 233 | 5 | encryption_mode = aes_mode_map.at(mode_str); | 234 | 5 | } | 235 | 5 | } | 236 | 5 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 237 | 5 | const ColumnString::Chars* chars_column = &column->get_chars(); | 238 | 10 | for (int i = 0; i < input_rows_count; ++i) { | 239 | 5 | if (all_insert_null || null_map[i]) { | 240 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 241 | 0 | continue; | 242 | 0 | } | 243 | 5 | execute_result_const<Impl, is_encrypt>(offsets_column, chars_column, key_arg, i, | 244 | 5 | encryption_mode, nullptr, 0, result_data, | 245 | 5 | result_offset, null_map, nullptr, 0); | 246 | 5 | } | 247 | 5 | } |
|
248 | | |
249 | | static void vector_vector(std::vector<const ColumnString::Offsets*>& offsets_list, |
250 | | std::vector<const ColumnString::Chars*>& chars_list, |
251 | | size_t input_rows_count, ColumnString::Chars& result_data, |
252 | 68 | ColumnString::Offsets& result_offset, NullMap& null_map) { |
253 | 147 | for (int i = 0; i < input_rows_count; ++i) { |
254 | 79 | if (null_map[i]) { |
255 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
256 | 0 | continue; |
257 | 0 | } |
258 | 79 | EncryptionMode encryption_mode = mode; |
259 | 79 | int mode_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; |
260 | 79 | const auto* mode_raw = |
261 | 79 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); |
262 | 79 | if (mode_size != 0) { |
263 | 79 | std::string mode_str(mode_raw, mode_size); |
264 | 79 | if (aes_mode_map.count(mode_str) == 0) { |
265 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
266 | 0 | continue; |
267 | 0 | } |
268 | 79 | encryption_mode = aes_mode_map.at(mode_str); |
269 | 79 | } |
270 | 79 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, |
271 | 79 | nullptr, 0, result_data, result_offset, |
272 | 79 | null_map, nullptr, 0); |
273 | 79 | } |
274 | 68 | } Unexecuted instantiation: _ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Unexecuted instantiation: _ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ _ZN5doris27EncryptionAndDecryptTwoImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 252 | 37 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 253 | 80 | for (int i = 0; i < input_rows_count; ++i) { | 254 | 43 | if (null_map[i]) { | 255 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 256 | 0 | continue; | 257 | 0 | } | 258 | 43 | EncryptionMode encryption_mode = mode; | 259 | 43 | int mode_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 260 | 43 | const auto* mode_raw = | 261 | 43 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 262 | 43 | if (mode_size != 0) { | 263 | 43 | std::string mode_str(mode_raw, mode_size); | 264 | 43 | if (aes_mode_map.count(mode_str) == 0) { | 265 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 266 | 0 | continue; | 267 | 0 | } | 268 | 43 | encryption_mode = aes_mode_map.at(mode_str); | 269 | 43 | } | 270 | 43 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 271 | 43 | nullptr, 0, result_data, result_offset, | 272 | 43 | null_map, nullptr, 0); | 273 | 43 | } | 274 | 37 | } |
_ZN5doris27EncryptionAndDecryptTwoImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 252 | 31 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 253 | 67 | for (int i = 0; i < input_rows_count; ++i) { | 254 | 36 | if (null_map[i]) { | 255 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 256 | 0 | continue; | 257 | 0 | } | 258 | 36 | EncryptionMode encryption_mode = mode; | 259 | 36 | int mode_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 260 | 36 | const auto* mode_raw = | 261 | 36 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 262 | 36 | if (mode_size != 0) { | 263 | 36 | std::string mode_str(mode_raw, mode_size); | 264 | 36 | if (aes_mode_map.count(mode_str) == 0) { | 265 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 266 | 0 | continue; | 267 | 0 | } | 268 | 36 | encryption_mode = aes_mode_map.at(mode_str); | 269 | 36 | } | 270 | 36 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 271 | 36 | nullptr, 0, result_data, result_offset, | 272 | 36 | null_map, nullptr, 0); | 273 | 36 | } | 274 | 31 | } |
|
275 | | }; |
276 | | |
277 | | template <typename Impl, EncryptionMode mode, bool is_encrypt, bool is_sm_mode, int arg_num = 4> |
278 | | struct EncryptionAndDecryptMultiImpl { |
279 | 891 | static DataTypes get_variadic_argument_types_impl() { |
280 | 891 | if constexpr (arg_num == 5) { |
281 | 24 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), |
282 | 24 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), |
283 | 24 | std::make_shared<DataTypeString>()}; |
284 | 867 | } else { |
285 | 867 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), |
286 | 867 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; |
287 | 867 | } |
288 | 891 | } _ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EE32get_variadic_argument_types_implEv Line | Count | Source | 279 | 270 | static DataTypes get_variadic_argument_types_impl() { | 280 | | if constexpr (arg_num == 5) { | 281 | | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 282 | | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 283 | | std::make_shared<DataTypeString>()}; | 284 | 270 | } else { | 285 | 270 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 286 | 270 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; | 287 | 270 | } | 288 | 270 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EE32get_variadic_argument_types_implEv Line | Count | Source | 279 | 241 | static DataTypes get_variadic_argument_types_impl() { | 280 | | if constexpr (arg_num == 5) { | 281 | | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 282 | | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 283 | | std::make_shared<DataTypeString>()}; | 284 | 241 | } else { | 285 | 241 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 286 | 241 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; | 287 | 241 | } | 288 | 241 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EE32get_variadic_argument_types_implEv Line | Count | Source | 279 | 188 | static DataTypes get_variadic_argument_types_impl() { | 280 | | if constexpr (arg_num == 5) { | 281 | | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 282 | | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 283 | | std::make_shared<DataTypeString>()}; | 284 | 188 | } else { | 285 | 188 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 286 | 188 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; | 287 | 188 | } | 288 | 188 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EE32get_variadic_argument_types_implEv Line | Count | Source | 279 | 168 | static DataTypes get_variadic_argument_types_impl() { | 280 | | if constexpr (arg_num == 5) { | 281 | | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 282 | | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 283 | | std::make_shared<DataTypeString>()}; | 284 | 168 | } else { | 285 | 168 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 286 | 168 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; | 287 | 168 | } | 288 | 168 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EE32get_variadic_argument_types_implEv Line | Count | Source | 279 | 12 | static DataTypes get_variadic_argument_types_impl() { | 280 | 12 | if constexpr (arg_num == 5) { | 281 | 12 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 282 | 12 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 283 | 12 | std::make_shared<DataTypeString>()}; | 284 | | } else { | 285 | | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 286 | | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; | 287 | | } | 288 | 12 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EE32get_variadic_argument_types_implEv Line | Count | Source | 279 | 12 | static DataTypes get_variadic_argument_types_impl() { | 280 | 12 | if constexpr (arg_num == 5) { | 281 | 12 | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 282 | 12 | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 283 | 12 | std::make_shared<DataTypeString>()}; | 284 | | } else { | 285 | | return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), | 286 | | std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>()}; | 287 | | } | 288 | 12 | } |
|
289 | | |
290 | | static Status execute_impl_inner(FunctionContext* context, Block& block, |
291 | | const ColumnNumbers& arguments, uint32_t result, |
292 | 897 | size_t input_rows_count) { |
293 | 897 | auto result_column = ColumnString::create(); |
294 | 897 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); |
295 | 897 | DCHECK_EQ(arguments.size(), arg_num); |
296 | 897 | const size_t argument_size = arg_num; |
297 | 897 | bool col_const[argument_size]; |
298 | 897 | ColumnPtr argument_columns[argument_size]; |
299 | 4.49k | for (int i = 0; i < argument_size; ++i) { |
300 | 3.59k | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); |
301 | 3.59k | } |
302 | 897 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( |
303 | 255 | *block.get_by_position(arguments[0]).column) |
304 | 255 | .convert_to_full_column() |
305 | 897 | : block.get_by_position(arguments[0]).column; |
306 | | |
307 | 897 | if constexpr (arg_num == 5) { |
308 | 8 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, |
309 | 8 | arguments); |
310 | 889 | } else { |
311 | 889 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, |
312 | 889 | arguments); |
313 | 889 | } |
314 | | |
315 | 897 | auto& result_data = result_column->get_chars(); |
316 | 897 | auto& result_offset = result_column->get_offsets(); |
317 | 897 | result_offset.resize(input_rows_count); |
318 | | |
319 | 897 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { |
320 | 2 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), |
321 | 2 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), |
322 | 2 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, |
323 | 2 | result_offset, result_null_map_column->get_data(), |
324 | 2 | argument_columns[4]->get_data_at(0)); |
325 | 895 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { |
326 | 70 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), |
327 | 70 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), |
328 | 70 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, |
329 | 70 | result_offset, result_null_map_column->get_data(), StringRef()); |
330 | 825 | } else { |
331 | 825 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); |
332 | 825 | std::vector<const ColumnString::Chars*> chars_list(argument_size); |
333 | 4.13k | for (size_t i = 0; i < argument_size; ++i) { |
334 | 3.30k | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); |
335 | 3.30k | offsets_list[i] = &col_str->get_offsets(); |
336 | 3.30k | chars_list[i] = &col_str->get_chars(); |
337 | 3.30k | } |
338 | 825 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, |
339 | 825 | result_null_map_column->get_data()); |
340 | 825 | } |
341 | 897 | block.get_by_position(result).column = |
342 | 897 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); |
343 | 897 | return Status::OK(); |
344 | 897 | } _ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 292 | 268 | size_t input_rows_count) { | 293 | 268 | auto result_column = ColumnString::create(); | 294 | 268 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 295 | 268 | DCHECK_EQ(arguments.size(), arg_num); | 296 | 268 | const size_t argument_size = arg_num; | 297 | 268 | bool col_const[argument_size]; | 298 | 268 | ColumnPtr argument_columns[argument_size]; | 299 | 1.34k | for (int i = 0; i < argument_size; ++i) { | 300 | 1.07k | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 301 | 1.07k | } | 302 | 268 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 303 | 94 | *block.get_by_position(arguments[0]).column) | 304 | 94 | .convert_to_full_column() | 305 | 268 | : block.get_by_position(arguments[0]).column; | 306 | | | 307 | | if constexpr (arg_num == 5) { | 308 | | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, | 309 | | arguments); | 310 | 268 | } else { | 311 | 268 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, | 312 | 268 | arguments); | 313 | 268 | } | 314 | | | 315 | 268 | auto& result_data = result_column->get_chars(); | 316 | 268 | auto& result_offset = result_column->get_offsets(); | 317 | 268 | result_offset.resize(input_rows_count); | 318 | | | 319 | 268 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { | 320 | 0 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 321 | 0 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 322 | 0 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 323 | 0 | result_offset, result_null_map_column->get_data(), | 324 | 0 | argument_columns[4]->get_data_at(0)); | 325 | 268 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { | 326 | 20 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 327 | 20 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 328 | 20 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 329 | 20 | result_offset, result_null_map_column->get_data(), StringRef()); | 330 | 248 | } else { | 331 | 248 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 332 | 248 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 333 | 1.24k | for (size_t i = 0; i < argument_size; ++i) { | 334 | 992 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 335 | 992 | offsets_list[i] = &col_str->get_offsets(); | 336 | 992 | chars_list[i] = &col_str->get_chars(); | 337 | 992 | } | 338 | 248 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 339 | 248 | result_null_map_column->get_data()); | 340 | 248 | } | 341 | 268 | block.get_by_position(result).column = | 342 | 268 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 343 | 268 | return Status::OK(); | 344 | 268 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 292 | 239 | size_t input_rows_count) { | 293 | 239 | auto result_column = ColumnString::create(); | 294 | 239 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 295 | 239 | DCHECK_EQ(arguments.size(), arg_num); | 296 | 239 | const size_t argument_size = arg_num; | 297 | 239 | bool col_const[argument_size]; | 298 | 239 | ColumnPtr argument_columns[argument_size]; | 299 | 1.19k | for (int i = 0; i < argument_size; ++i) { | 300 | 956 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 301 | 956 | } | 302 | 239 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 303 | 72 | *block.get_by_position(arguments[0]).column) | 304 | 72 | .convert_to_full_column() | 305 | 239 | : block.get_by_position(arguments[0]).column; | 306 | | | 307 | | if constexpr (arg_num == 5) { | 308 | | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, | 309 | | arguments); | 310 | 239 | } else { | 311 | 239 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, | 312 | 239 | arguments); | 313 | 239 | } | 314 | | | 315 | 239 | auto& result_data = result_column->get_chars(); | 316 | 239 | auto& result_offset = result_column->get_offsets(); | 317 | 239 | result_offset.resize(input_rows_count); | 318 | | | 319 | 239 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { | 320 | 0 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 321 | 0 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 322 | 0 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 323 | 0 | result_offset, result_null_map_column->get_data(), | 324 | 0 | argument_columns[4]->get_data_at(0)); | 325 | 239 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { | 326 | 17 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 327 | 17 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 328 | 17 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 329 | 17 | result_offset, result_null_map_column->get_data(), StringRef()); | 330 | 222 | } else { | 331 | 222 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 332 | 222 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 333 | 1.11k | for (size_t i = 0; i < argument_size; ++i) { | 334 | 888 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 335 | 888 | offsets_list[i] = &col_str->get_offsets(); | 336 | 888 | chars_list[i] = &col_str->get_chars(); | 337 | 888 | } | 338 | 222 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 339 | 222 | result_null_map_column->get_data()); | 340 | 222 | } | 341 | 239 | block.get_by_position(result).column = | 342 | 239 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 343 | 239 | return Status::OK(); | 344 | 239 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 292 | 201 | size_t input_rows_count) { | 293 | 201 | auto result_column = ColumnString::create(); | 294 | 201 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 295 | 201 | DCHECK_EQ(arguments.size(), arg_num); | 296 | 201 | const size_t argument_size = arg_num; | 297 | 201 | bool col_const[argument_size]; | 298 | 201 | ColumnPtr argument_columns[argument_size]; | 299 | 1.00k | for (int i = 0; i < argument_size; ++i) { | 300 | 804 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 301 | 804 | } | 302 | 201 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 303 | 52 | *block.get_by_position(arguments[0]).column) | 304 | 52 | .convert_to_full_column() | 305 | 201 | : block.get_by_position(arguments[0]).column; | 306 | | | 307 | | if constexpr (arg_num == 5) { | 308 | | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, | 309 | | arguments); | 310 | 201 | } else { | 311 | 201 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, | 312 | 201 | arguments); | 313 | 201 | } | 314 | | | 315 | 201 | auto& result_data = result_column->get_chars(); | 316 | 201 | auto& result_offset = result_column->get_offsets(); | 317 | 201 | result_offset.resize(input_rows_count); | 318 | | | 319 | 201 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { | 320 | 0 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 321 | 0 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 322 | 0 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 323 | 0 | result_offset, result_null_map_column->get_data(), | 324 | 0 | argument_columns[4]->get_data_at(0)); | 325 | 201 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { | 326 | 18 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 327 | 18 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 328 | 18 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 329 | 18 | result_offset, result_null_map_column->get_data(), StringRef()); | 330 | 183 | } else { | 331 | 183 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 332 | 183 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 333 | 915 | for (size_t i = 0; i < argument_size; ++i) { | 334 | 732 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 335 | 732 | offsets_list[i] = &col_str->get_offsets(); | 336 | 732 | chars_list[i] = &col_str->get_chars(); | 337 | 732 | } | 338 | 183 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 339 | 183 | result_null_map_column->get_data()); | 340 | 183 | } | 341 | 201 | block.get_by_position(result).column = | 342 | 201 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 343 | 201 | return Status::OK(); | 344 | 201 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 292 | 181 | size_t input_rows_count) { | 293 | 181 | auto result_column = ColumnString::create(); | 294 | 181 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 295 | 181 | DCHECK_EQ(arguments.size(), arg_num); | 296 | 181 | const size_t argument_size = arg_num; | 297 | 181 | bool col_const[argument_size]; | 298 | 181 | ColumnPtr argument_columns[argument_size]; | 299 | 905 | for (int i = 0; i < argument_size; ++i) { | 300 | 724 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 301 | 724 | } | 302 | 181 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 303 | 37 | *block.get_by_position(arguments[0]).column) | 304 | 37 | .convert_to_full_column() | 305 | 181 | : block.get_by_position(arguments[0]).column; | 306 | | | 307 | | if constexpr (arg_num == 5) { | 308 | | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, | 309 | | arguments); | 310 | 181 | } else { | 311 | 181 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, | 312 | 181 | arguments); | 313 | 181 | } | 314 | | | 315 | 181 | auto& result_data = result_column->get_chars(); | 316 | 181 | auto& result_offset = result_column->get_offsets(); | 317 | 181 | result_offset.resize(input_rows_count); | 318 | | | 319 | 181 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { | 320 | 0 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 321 | 0 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 322 | 0 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 323 | 0 | result_offset, result_null_map_column->get_data(), | 324 | 0 | argument_columns[4]->get_data_at(0)); | 325 | 181 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { | 326 | 15 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 327 | 15 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 328 | 15 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 329 | 15 | result_offset, result_null_map_column->get_data(), StringRef()); | 330 | 166 | } else { | 331 | 166 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 332 | 166 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 333 | 830 | for (size_t i = 0; i < argument_size; ++i) { | 334 | 664 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 335 | 664 | offsets_list[i] = &col_str->get_offsets(); | 336 | 664 | chars_list[i] = &col_str->get_chars(); | 337 | 664 | } | 338 | 166 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 339 | 166 | result_null_map_column->get_data()); | 340 | 166 | } | 341 | 181 | block.get_by_position(result).column = | 342 | 181 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 343 | 181 | return Status::OK(); | 344 | 181 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 292 | 4 | size_t input_rows_count) { | 293 | 4 | auto result_column = ColumnString::create(); | 294 | 4 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 295 | 4 | DCHECK_EQ(arguments.size(), arg_num); | 296 | 4 | const size_t argument_size = arg_num; | 297 | 4 | bool col_const[argument_size]; | 298 | 4 | ColumnPtr argument_columns[argument_size]; | 299 | 24 | for (int i = 0; i < argument_size; ++i) { | 300 | 20 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 301 | 20 | } | 302 | 4 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 303 | 0 | *block.get_by_position(arguments[0]).column) | 304 | 0 | .convert_to_full_column() | 305 | 4 | : block.get_by_position(arguments[0]).column; | 306 | | | 307 | 4 | if constexpr (arg_num == 5) { | 308 | 4 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, | 309 | 4 | arguments); | 310 | | } else { | 311 | | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, | 312 | | arguments); | 313 | | } | 314 | | | 315 | 4 | auto& result_data = result_column->get_chars(); | 316 | 4 | auto& result_offset = result_column->get_offsets(); | 317 | 4 | result_offset.resize(input_rows_count); | 318 | | | 319 | 4 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { | 320 | 1 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 321 | 1 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 322 | 1 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 323 | 1 | result_offset, result_null_map_column->get_data(), | 324 | 1 | argument_columns[4]->get_data_at(0)); | 325 | 3 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { | 326 | 0 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 327 | 0 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 328 | 0 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 329 | 0 | result_offset, result_null_map_column->get_data(), StringRef()); | 330 | 3 | } else { | 331 | 3 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 332 | 3 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 333 | 18 | for (size_t i = 0; i < argument_size; ++i) { | 334 | 15 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 335 | 15 | offsets_list[i] = &col_str->get_offsets(); | 336 | 15 | chars_list[i] = &col_str->get_chars(); | 337 | 15 | } | 338 | 3 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 339 | 3 | result_null_map_column->get_data()); | 340 | 3 | } | 341 | 4 | block.get_by_position(result).column = | 342 | 4 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 343 | 4 | return Status::OK(); | 344 | 4 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EE18execute_impl_innerEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 292 | 4 | size_t input_rows_count) { | 293 | 4 | auto result_column = ColumnString::create(); | 294 | 4 | auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); | 295 | 4 | DCHECK_EQ(arguments.size(), arg_num); | 296 | 4 | const size_t argument_size = arg_num; | 297 | 4 | bool col_const[argument_size]; | 298 | 4 | ColumnPtr argument_columns[argument_size]; | 299 | 24 | for (int i = 0; i < argument_size; ++i) { | 300 | 20 | col_const[i] = is_column_const(*block.get_by_position(arguments[i]).column); | 301 | 20 | } | 302 | 4 | argument_columns[0] = col_const[0] ? static_cast<const ColumnConst&>( | 303 | 0 | *block.get_by_position(arguments[0]).column) | 304 | 0 | .convert_to_full_column() | 305 | 4 | : block.get_by_position(arguments[0]).column; | 306 | | | 307 | 4 | if constexpr (arg_num == 5) { | 308 | 4 | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3, 4}, block, | 309 | 4 | arguments); | 310 | | } else { | 311 | | default_preprocess_parameter_columns(argument_columns, col_const, {1, 2, 3}, block, | 312 | | arguments); | 313 | | } | 314 | | | 315 | 4 | auto& result_data = result_column->get_chars(); | 316 | 4 | auto& result_offset = result_column->get_offsets(); | 317 | 4 | result_offset.resize(input_rows_count); | 318 | | | 319 | 4 | if ((arg_num == 5) && col_const[1] && col_const[2] && col_const[3] && col_const[4]) { | 320 | 1 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 321 | 1 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 322 | 1 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 323 | 1 | result_offset, result_null_map_column->get_data(), | 324 | 1 | argument_columns[4]->get_data_at(0)); | 325 | 3 | } else if ((arg_num == 4) && col_const[1] && col_const[2] && col_const[3]) { | 326 | 0 | vector_const(assert_cast<const ColumnString*>(argument_columns[0].get()), | 327 | 0 | argument_columns[1]->get_data_at(0), argument_columns[2]->get_data_at(0), | 328 | 0 | argument_columns[3]->get_data_at(0), input_rows_count, result_data, | 329 | 0 | result_offset, result_null_map_column->get_data(), StringRef()); | 330 | 3 | } else { | 331 | 3 | std::vector<const ColumnString::Offsets*> offsets_list(argument_size); | 332 | 3 | std::vector<const ColumnString::Chars*> chars_list(argument_size); | 333 | 18 | for (size_t i = 0; i < argument_size; ++i) { | 334 | 15 | const auto* col_str = assert_cast<const ColumnString*>(argument_columns[i].get()); | 335 | 15 | offsets_list[i] = &col_str->get_offsets(); | 336 | 15 | chars_list[i] = &col_str->get_chars(); | 337 | 15 | } | 338 | 3 | vector_vector(offsets_list, chars_list, input_rows_count, result_data, result_offset, | 339 | 3 | result_null_map_column->get_data()); | 340 | 3 | } | 341 | 4 | block.get_by_position(result).column = | 342 | 4 | ColumnNullable::create(std::move(result_column), std::move(result_null_map_column)); | 343 | 4 | return Status::OK(); | 344 | 4 | } |
|
345 | | |
346 | | static void vector_const(const ColumnString* column, StringRef key_arg, StringRef iv_arg, |
347 | | StringRef mode_arg, size_t input_rows_count, |
348 | | ColumnString::Chars& result_data, ColumnString::Offsets& result_offset, |
349 | 72 | NullMap& null_map, StringRef aad_arg) { |
350 | 72 | EncryptionMode encryption_mode = mode; |
351 | 72 | bool all_insert_null = false; |
352 | 72 | if (mode_arg.size != 0) { |
353 | 72 | std::string mode_str(mode_arg.data, mode_arg.size); |
354 | 72 | if constexpr (is_sm_mode) { |
355 | 37 | if (sm4_mode_map.count(mode_str) == 0) { |
356 | 1 | all_insert_null = true; |
357 | 36 | } else { |
358 | 36 | encryption_mode = sm4_mode_map.at(mode_str); |
359 | 36 | } |
360 | 37 | } else { |
361 | 35 | if (aes_mode_map.count(mode_str) == 0) { |
362 | 0 | all_insert_null = true; |
363 | 35 | } else { |
364 | 35 | encryption_mode = aes_mode_map.at(mode_str); |
365 | 35 | } |
366 | 35 | } |
367 | 72 | } |
368 | | |
369 | 72 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); |
370 | 72 | const ColumnString::Chars* chars_column = &column->get_chars(); |
371 | 162 | for (int i = 0; i < input_rows_count; ++i) { |
372 | 90 | if (all_insert_null || null_map[i]) { |
373 | 1 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
374 | 1 | continue; |
375 | 1 | } |
376 | 89 | execute_result_const<Impl, is_encrypt>( |
377 | 89 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, |
378 | 89 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); |
379 | 89 | } |
380 | 72 | } _ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_S8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_S8_ Line | Count | Source | 349 | 20 | NullMap& null_map, StringRef aad_arg) { | 350 | 20 | EncryptionMode encryption_mode = mode; | 351 | 20 | bool all_insert_null = false; | 352 | 20 | if (mode_arg.size != 0) { | 353 | 20 | std::string mode_str(mode_arg.data, mode_arg.size); | 354 | 20 | if constexpr (is_sm_mode) { | 355 | 20 | if (sm4_mode_map.count(mode_str) == 0) { | 356 | 0 | all_insert_null = true; | 357 | 20 | } else { | 358 | 20 | encryption_mode = sm4_mode_map.at(mode_str); | 359 | 20 | } | 360 | | } else { | 361 | | if (aes_mode_map.count(mode_str) == 0) { | 362 | | all_insert_null = true; | 363 | | } else { | 364 | | encryption_mode = aes_mode_map.at(mode_str); | 365 | | } | 366 | | } | 367 | 20 | } | 368 | | | 369 | 20 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 370 | 20 | const ColumnString::Chars* chars_column = &column->get_chars(); | 371 | 40 | for (int i = 0; i < input_rows_count; ++i) { | 372 | 20 | if (all_insert_null || null_map[i]) { | 373 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 374 | 0 | continue; | 375 | 0 | } | 376 | 20 | execute_result_const<Impl, is_encrypt>( | 377 | 20 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, | 378 | 20 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); | 379 | 20 | } | 380 | 20 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_S8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_S8_ Line | Count | Source | 349 | 17 | NullMap& null_map, StringRef aad_arg) { | 350 | 17 | EncryptionMode encryption_mode = mode; | 351 | 17 | bool all_insert_null = false; | 352 | 17 | if (mode_arg.size != 0) { | 353 | 17 | std::string mode_str(mode_arg.data, mode_arg.size); | 354 | 17 | if constexpr (is_sm_mode) { | 355 | 17 | if (sm4_mode_map.count(mode_str) == 0) { | 356 | 1 | all_insert_null = true; | 357 | 16 | } else { | 358 | 16 | encryption_mode = sm4_mode_map.at(mode_str); | 359 | 16 | } | 360 | | } else { | 361 | | if (aes_mode_map.count(mode_str) == 0) { | 362 | | all_insert_null = true; | 363 | | } else { | 364 | | encryption_mode = aes_mode_map.at(mode_str); | 365 | | } | 366 | | } | 367 | 17 | } | 368 | | | 369 | 17 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 370 | 17 | const ColumnString::Chars* chars_column = &column->get_chars(); | 371 | 34 | for (int i = 0; i < input_rows_count; ++i) { | 372 | 17 | if (all_insert_null || null_map[i]) { | 373 | 1 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 374 | 1 | continue; | 375 | 1 | } | 376 | 16 | execute_result_const<Impl, is_encrypt>( | 377 | 16 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, | 378 | 16 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); | 379 | 16 | } | 380 | 17 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_S8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_S8_ Line | Count | Source | 349 | 18 | NullMap& null_map, StringRef aad_arg) { | 350 | 18 | EncryptionMode encryption_mode = mode; | 351 | 18 | bool all_insert_null = false; | 352 | 18 | if (mode_arg.size != 0) { | 353 | 18 | std::string mode_str(mode_arg.data, mode_arg.size); | 354 | | if constexpr (is_sm_mode) { | 355 | | if (sm4_mode_map.count(mode_str) == 0) { | 356 | | all_insert_null = true; | 357 | | } else { | 358 | | encryption_mode = sm4_mode_map.at(mode_str); | 359 | | } | 360 | 18 | } else { | 361 | 18 | if (aes_mode_map.count(mode_str) == 0) { | 362 | 0 | all_insert_null = true; | 363 | 18 | } else { | 364 | 18 | encryption_mode = aes_mode_map.at(mode_str); | 365 | 18 | } | 366 | 18 | } | 367 | 18 | } | 368 | | | 369 | 18 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 370 | 18 | const ColumnString::Chars* chars_column = &column->get_chars(); | 371 | 44 | for (int i = 0; i < input_rows_count; ++i) { | 372 | 26 | if (all_insert_null || null_map[i]) { | 373 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 374 | 0 | continue; | 375 | 0 | } | 376 | 26 | execute_result_const<Impl, is_encrypt>( | 377 | 26 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, | 378 | 26 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); | 379 | 26 | } | 380 | 18 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_S8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_S8_ Line | Count | Source | 349 | 15 | NullMap& null_map, StringRef aad_arg) { | 350 | 15 | EncryptionMode encryption_mode = mode; | 351 | 15 | bool all_insert_null = false; | 352 | 15 | if (mode_arg.size != 0) { | 353 | 15 | std::string mode_str(mode_arg.data, mode_arg.size); | 354 | | if constexpr (is_sm_mode) { | 355 | | if (sm4_mode_map.count(mode_str) == 0) { | 356 | | all_insert_null = true; | 357 | | } else { | 358 | | encryption_mode = sm4_mode_map.at(mode_str); | 359 | | } | 360 | 15 | } else { | 361 | 15 | if (aes_mode_map.count(mode_str) == 0) { | 362 | 0 | all_insert_null = true; | 363 | 15 | } else { | 364 | 15 | encryption_mode = aes_mode_map.at(mode_str); | 365 | 15 | } | 366 | 15 | } | 367 | 15 | } | 368 | | | 369 | 15 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 370 | 15 | const ColumnString::Chars* chars_column = &column->get_chars(); | 371 | 40 | for (int i = 0; i < input_rows_count; ++i) { | 372 | 25 | if (all_insert_null || null_map[i]) { | 373 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 374 | 0 | continue; | 375 | 0 | } | 376 | 25 | execute_result_const<Impl, is_encrypt>( | 377 | 25 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, | 378 | 25 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); | 379 | 25 | } | 380 | 15 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_S8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_S8_ Line | Count | Source | 349 | 1 | NullMap& null_map, StringRef aad_arg) { | 350 | 1 | EncryptionMode encryption_mode = mode; | 351 | 1 | bool all_insert_null = false; | 352 | 1 | if (mode_arg.size != 0) { | 353 | 1 | std::string mode_str(mode_arg.data, mode_arg.size); | 354 | | if constexpr (is_sm_mode) { | 355 | | if (sm4_mode_map.count(mode_str) == 0) { | 356 | | all_insert_null = true; | 357 | | } else { | 358 | | encryption_mode = sm4_mode_map.at(mode_str); | 359 | | } | 360 | 1 | } else { | 361 | 1 | if (aes_mode_map.count(mode_str) == 0) { | 362 | 0 | all_insert_null = true; | 363 | 1 | } else { | 364 | 1 | encryption_mode = aes_mode_map.at(mode_str); | 365 | 1 | } | 366 | 1 | } | 367 | 1 | } | 368 | | | 369 | 1 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 370 | 1 | const ColumnString::Chars* chars_column = &column->get_chars(); | 371 | 2 | for (int i = 0; i < input_rows_count; ++i) { | 372 | 1 | if (all_insert_null || null_map[i]) { | 373 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 374 | 0 | continue; | 375 | 0 | } | 376 | 1 | execute_result_const<Impl, is_encrypt>( | 377 | 1 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, | 378 | 1 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); | 379 | 1 | } | 380 | 1 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EE12vector_constEPKNS_9ColumnStrIjEENS_9StringRefES8_S8_mRNS_8PODArrayIhLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEERNS9_IjLm4096ESC_Lm16ELm15EEESE_S8_ Line | Count | Source | 349 | 1 | NullMap& null_map, StringRef aad_arg) { | 350 | 1 | EncryptionMode encryption_mode = mode; | 351 | 1 | bool all_insert_null = false; | 352 | 1 | if (mode_arg.size != 0) { | 353 | 1 | std::string mode_str(mode_arg.data, mode_arg.size); | 354 | | if constexpr (is_sm_mode) { | 355 | | if (sm4_mode_map.count(mode_str) == 0) { | 356 | | all_insert_null = true; | 357 | | } else { | 358 | | encryption_mode = sm4_mode_map.at(mode_str); | 359 | | } | 360 | 1 | } else { | 361 | 1 | if (aes_mode_map.count(mode_str) == 0) { | 362 | 0 | all_insert_null = true; | 363 | 1 | } else { | 364 | 1 | encryption_mode = aes_mode_map.at(mode_str); | 365 | 1 | } | 366 | 1 | } | 367 | 1 | } | 368 | | | 369 | 1 | const ColumnString::Offsets* offsets_column = &column->get_offsets(); | 370 | 1 | const ColumnString::Chars* chars_column = &column->get_chars(); | 371 | 2 | for (int i = 0; i < input_rows_count; ++i) { | 372 | 1 | if (all_insert_null || null_map[i]) { | 373 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 374 | 0 | continue; | 375 | 0 | } | 376 | 1 | execute_result_const<Impl, is_encrypt>( | 377 | 1 | offsets_column, chars_column, key_arg, i, encryption_mode, iv_arg.data, | 378 | 1 | iv_arg.size, result_data, result_offset, null_map, aad_arg.data, aad_arg.size); | 379 | 1 | } | 380 | 1 | } |
|
381 | | |
382 | | static void vector_vector(std::vector<const ColumnString::Offsets*>& offsets_list, |
383 | | std::vector<const ColumnString::Chars*>& chars_list, |
384 | | size_t input_rows_count, ColumnString::Chars& result_data, |
385 | 825 | ColumnString::Offsets& result_offset, NullMap& null_map) { |
386 | 2.09k | for (int i = 0; i < input_rows_count; ++i) { |
387 | 1.26k | if (null_map[i]) { |
388 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
389 | 0 | continue; |
390 | 0 | } |
391 | | |
392 | 1.26k | EncryptionMode encryption_mode = mode; |
393 | 1.26k | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; |
394 | 1.26k | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; |
395 | 1.26k | const auto* mode_raw = |
396 | 1.26k | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); |
397 | 1.26k | const auto* iv_raw = |
398 | 1.26k | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); |
399 | 1.26k | if (mode_size != 0) { |
400 | 1.26k | std::string mode_str(mode_raw, mode_size); |
401 | 1.26k | if constexpr (is_sm_mode) { |
402 | 696 | if (sm4_mode_map.count(mode_str) == 0) { |
403 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
404 | 0 | continue; |
405 | 0 | } |
406 | 696 | encryption_mode = sm4_mode_map.at(mode_str); |
407 | 696 | } else { |
408 | 572 | if (aes_mode_map.count(mode_str) == 0) { |
409 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); |
410 | 0 | continue; |
411 | 0 | } |
412 | 572 | encryption_mode = aes_mode_map.at(mode_str); |
413 | 572 | } |
414 | 1.26k | } |
415 | | |
416 | 0 | int aad_size = 0; |
417 | 1.26k | const char* aad = nullptr; |
418 | 1.26k | if constexpr (arg_num == 5) { |
419 | 8 | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; |
420 | 8 | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); |
421 | 8 | } |
422 | | |
423 | 1.26k | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, |
424 | 1.26k | iv_raw, iv_size, result_data, result_offset, |
425 | 1.26k | null_map, aad, aad_size); |
426 | 1.26k | } |
427 | 825 | } _ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE27ELb1ELb1ELi4EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 385 | 248 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 386 | 610 | for (int i = 0; i < input_rows_count; ++i) { | 387 | 362 | if (null_map[i]) { | 388 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 389 | 0 | continue; | 390 | 0 | } | 391 | | | 392 | 362 | EncryptionMode encryption_mode = mode; | 393 | 362 | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; | 394 | 362 | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 395 | 362 | const auto* mode_raw = | 396 | 362 | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); | 397 | 362 | const auto* iv_raw = | 398 | 362 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 399 | 362 | if (mode_size != 0) { | 400 | 362 | std::string mode_str(mode_raw, mode_size); | 401 | 362 | if constexpr (is_sm_mode) { | 402 | 362 | if (sm4_mode_map.count(mode_str) == 0) { | 403 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 404 | 0 | continue; | 405 | 0 | } | 406 | 362 | encryption_mode = sm4_mode_map.at(mode_str); | 407 | | } else { | 408 | | if (aes_mode_map.count(mode_str) == 0) { | 409 | | StringOP::push_null_string(i, result_data, result_offset, null_map); | 410 | | continue; | 411 | | } | 412 | | encryption_mode = aes_mode_map.at(mode_str); | 413 | | } | 414 | 362 | } | 415 | | | 416 | 0 | int aad_size = 0; | 417 | 362 | const char* aad = nullptr; | 418 | | if constexpr (arg_num == 5) { | 419 | | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; | 420 | | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); | 421 | | } | 422 | | | 423 | 362 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 424 | 362 | iv_raw, iv_size, result_data, result_offset, | 425 | 362 | null_map, aad, aad_size); | 426 | 362 | } | 427 | 248 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE27ELb0ELb1ELi4EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 385 | 222 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 386 | 556 | for (int i = 0; i < input_rows_count; ++i) { | 387 | 334 | if (null_map[i]) { | 388 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 389 | 0 | continue; | 390 | 0 | } | 391 | | | 392 | 334 | EncryptionMode encryption_mode = mode; | 393 | 334 | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; | 394 | 334 | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 395 | 334 | const auto* mode_raw = | 396 | 334 | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); | 397 | 334 | const auto* iv_raw = | 398 | 334 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 399 | 334 | if (mode_size != 0) { | 400 | 334 | std::string mode_str(mode_raw, mode_size); | 401 | 334 | if constexpr (is_sm_mode) { | 402 | 334 | if (sm4_mode_map.count(mode_str) == 0) { | 403 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 404 | 0 | continue; | 405 | 0 | } | 406 | 334 | encryption_mode = sm4_mode_map.at(mode_str); | 407 | | } else { | 408 | | if (aes_mode_map.count(mode_str) == 0) { | 409 | | StringOP::push_null_string(i, result_data, result_offset, null_map); | 410 | | continue; | 411 | | } | 412 | | encryption_mode = aes_mode_map.at(mode_str); | 413 | | } | 414 | 334 | } | 415 | | | 416 | 0 | int aad_size = 0; | 417 | 334 | const char* aad = nullptr; | 418 | | if constexpr (arg_num == 5) { | 419 | | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; | 420 | | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); | 421 | | } | 422 | | | 423 | 334 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 424 | 334 | iv_raw, iv_size, result_data, result_offset, | 425 | 334 | null_map, aad, aad_size); | 426 | 334 | } | 427 | 222 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE0ELb1ELb0ELi4EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 385 | 183 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 386 | 474 | for (int i = 0; i < input_rows_count; ++i) { | 387 | 291 | if (null_map[i]) { | 388 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 389 | 0 | continue; | 390 | 0 | } | 391 | | | 392 | 291 | EncryptionMode encryption_mode = mode; | 393 | 291 | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; | 394 | 291 | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 395 | 291 | const auto* mode_raw = | 396 | 291 | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); | 397 | 291 | const auto* iv_raw = | 398 | 291 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 399 | 291 | if (mode_size != 0) { | 400 | 291 | std::string mode_str(mode_raw, mode_size); | 401 | | if constexpr (is_sm_mode) { | 402 | | if (sm4_mode_map.count(mode_str) == 0) { | 403 | | StringOP::push_null_string(i, result_data, result_offset, null_map); | 404 | | continue; | 405 | | } | 406 | | encryption_mode = sm4_mode_map.at(mode_str); | 407 | 291 | } else { | 408 | 291 | if (aes_mode_map.count(mode_str) == 0) { | 409 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 410 | 0 | continue; | 411 | 0 | } | 412 | 291 | encryption_mode = aes_mode_map.at(mode_str); | 413 | 291 | } | 414 | 291 | } | 415 | | | 416 | 0 | int aad_size = 0; | 417 | 291 | const char* aad = nullptr; | 418 | | if constexpr (arg_num == 5) { | 419 | | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; | 420 | | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); | 421 | | } | 422 | | | 423 | 291 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 424 | 291 | iv_raw, iv_size, result_data, result_offset, | 425 | 291 | null_map, aad, aad_size); | 426 | 291 | } | 427 | 183 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE0ELb0ELb0ELi4EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 385 | 166 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 386 | 439 | for (int i = 0; i < input_rows_count; ++i) { | 387 | 273 | if (null_map[i]) { | 388 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 389 | 0 | continue; | 390 | 0 | } | 391 | | | 392 | 273 | EncryptionMode encryption_mode = mode; | 393 | 273 | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; | 394 | 273 | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 395 | 273 | const auto* mode_raw = | 396 | 273 | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); | 397 | 273 | const auto* iv_raw = | 398 | 273 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 399 | 273 | if (mode_size != 0) { | 400 | 273 | std::string mode_str(mode_raw, mode_size); | 401 | | if constexpr (is_sm_mode) { | 402 | | if (sm4_mode_map.count(mode_str) == 0) { | 403 | | StringOP::push_null_string(i, result_data, result_offset, null_map); | 404 | | continue; | 405 | | } | 406 | | encryption_mode = sm4_mode_map.at(mode_str); | 407 | 273 | } else { | 408 | 273 | if (aes_mode_map.count(mode_str) == 0) { | 409 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 410 | 0 | continue; | 411 | 0 | } | 412 | 273 | encryption_mode = aes_mode_map.at(mode_str); | 413 | 273 | } | 414 | 273 | } | 415 | | | 416 | 0 | int aad_size = 0; | 417 | 273 | const char* aad = nullptr; | 418 | | if constexpr (arg_num == 5) { | 419 | | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; | 420 | | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); | 421 | | } | 422 | | | 423 | 273 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 424 | 273 | iv_raw, iv_size, result_data, result_offset, | 425 | 273 | null_map, aad, aad_size); | 426 | 273 | } | 427 | 166 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11EncryptImplELNS_14EncryptionModeE24ELb1ELb0ELi5EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 385 | 3 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 386 | 7 | for (int i = 0; i < input_rows_count; ++i) { | 387 | 4 | if (null_map[i]) { | 388 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 389 | 0 | continue; | 390 | 0 | } | 391 | | | 392 | 4 | EncryptionMode encryption_mode = mode; | 393 | 4 | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; | 394 | 4 | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 395 | 4 | const auto* mode_raw = | 396 | 4 | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); | 397 | 4 | const auto* iv_raw = | 398 | 4 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 399 | 4 | if (mode_size != 0) { | 400 | 4 | std::string mode_str(mode_raw, mode_size); | 401 | | if constexpr (is_sm_mode) { | 402 | | if (sm4_mode_map.count(mode_str) == 0) { | 403 | | StringOP::push_null_string(i, result_data, result_offset, null_map); | 404 | | continue; | 405 | | } | 406 | | encryption_mode = sm4_mode_map.at(mode_str); | 407 | 4 | } else { | 408 | 4 | if (aes_mode_map.count(mode_str) == 0) { | 409 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 410 | 0 | continue; | 411 | 0 | } | 412 | 4 | encryption_mode = aes_mode_map.at(mode_str); | 413 | 4 | } | 414 | 4 | } | 415 | | | 416 | 0 | int aad_size = 0; | 417 | 4 | const char* aad = nullptr; | 418 | 4 | if constexpr (arg_num == 5) { | 419 | 4 | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; | 420 | 4 | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); | 421 | 4 | } | 422 | | | 423 | 4 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 424 | 4 | iv_raw, iv_size, result_data, result_offset, | 425 | 4 | null_map, aad, aad_size); | 426 | 4 | } | 427 | 3 | } |
_ZN5doris29EncryptionAndDecryptMultiImplINS_11DecryptImplELNS_14EncryptionModeE24ELb0ELb0ELi5EE13vector_vectorERSt6vectorIPKNS_8PODArrayIjLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb0EEELm16ELm15EEESaISB_EERS4_IPKNS5_IhLm4096ES8_Lm16ELm15EEESaISH_EEmRSF_RS9_SL_ Line | Count | Source | 385 | 3 | ColumnString::Offsets& result_offset, NullMap& null_map) { | 386 | 7 | for (int i = 0; i < input_rows_count; ++i) { | 387 | 4 | if (null_map[i]) { | 388 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 389 | 0 | continue; | 390 | 0 | } | 391 | | | 392 | 4 | EncryptionMode encryption_mode = mode; | 393 | 4 | int mode_size = (*offsets_list[3])[i] - (*offsets_list[3])[i - 1]; | 394 | 4 | int iv_size = (*offsets_list[2])[i] - (*offsets_list[2])[i - 1]; | 395 | 4 | const auto* mode_raw = | 396 | 4 | reinterpret_cast<const char*>(&(*chars_list[3])[(*offsets_list[3])[i - 1]]); | 397 | 4 | const auto* iv_raw = | 398 | 4 | reinterpret_cast<const char*>(&(*chars_list[2])[(*offsets_list[2])[i - 1]]); | 399 | 4 | if (mode_size != 0) { | 400 | 4 | std::string mode_str(mode_raw, mode_size); | 401 | | if constexpr (is_sm_mode) { | 402 | | if (sm4_mode_map.count(mode_str) == 0) { | 403 | | StringOP::push_null_string(i, result_data, result_offset, null_map); | 404 | | continue; | 405 | | } | 406 | | encryption_mode = sm4_mode_map.at(mode_str); | 407 | 4 | } else { | 408 | 4 | if (aes_mode_map.count(mode_str) == 0) { | 409 | 0 | StringOP::push_null_string(i, result_data, result_offset, null_map); | 410 | 0 | continue; | 411 | 0 | } | 412 | 4 | encryption_mode = aes_mode_map.at(mode_str); | 413 | 4 | } | 414 | 4 | } | 415 | | | 416 | 0 | int aad_size = 0; | 417 | 4 | const char* aad = nullptr; | 418 | 4 | if constexpr (arg_num == 5) { | 419 | 4 | aad_size = (*offsets_list[4])[i] - (*offsets_list[4])[i - 1]; | 420 | 4 | aad = reinterpret_cast<const char*>(&(*chars_list[4])[(*offsets_list[4])[i - 1]]); | 421 | 4 | } | 422 | | | 423 | 4 | execute_result_vector<Impl, is_encrypt>(offsets_list, chars_list, i, encryption_mode, | 424 | 4 | iv_raw, iv_size, result_data, result_offset, | 425 | 4 | null_map, aad, aad_size); | 426 | 4 | } | 427 | 3 | } |
|
428 | | }; |
429 | | |
430 | | struct EncryptImpl { |
431 | | static int execute_impl(EncryptionMode mode, const unsigned char* source, size_t source_length, |
432 | | const unsigned char* key, size_t key_length, const char* iv, |
433 | | size_t iv_length, bool padding, unsigned char* encrypt, |
434 | 753 | const unsigned char* aad, size_t aad_length) { |
435 | | // now the openssl only support int, so here we need to cast size_t to uint32_t |
436 | 753 | return EncryptionUtil::encrypt(mode, source, cast_set<uint32_t>(source_length), key, |
437 | 753 | cast_set<uint32_t>(key_length), iv, cast_set<int>(iv_length), |
438 | 753 | true, encrypt, aad, cast_set<uint32_t>(aad_length)); |
439 | 753 | } |
440 | | }; |
441 | | |
442 | | struct DecryptImpl { |
443 | | static int execute_impl(EncryptionMode mode, const unsigned char* source, size_t source_length, |
444 | | const unsigned char* key, size_t key_length, const char* iv, |
445 | | size_t iv_length, bool padding, unsigned char* encrypt, |
446 | 694 | const unsigned char* aad, size_t aad_length) { |
447 | 694 | return EncryptionUtil::decrypt(mode, source, cast_set<uint32_t>(source_length), key, |
448 | 694 | cast_set<uint32_t>(key_length), iv, cast_set<int>(iv_length), |
449 | 694 | true, encrypt, aad, cast_set<uint32_t>(aad_length)); |
450 | 694 | } |
451 | | }; |
452 | | |
453 | | struct SM4EncryptName { |
454 | | static constexpr auto name = "sm4_encrypt"; |
455 | | }; |
456 | | |
457 | | struct SM4DecryptName { |
458 | | static constexpr auto name = "sm4_decrypt"; |
459 | | }; |
460 | | |
461 | | struct AESEncryptName { |
462 | | static constexpr auto name = "aes_encrypt"; |
463 | | }; |
464 | | |
465 | | struct AESDecryptName { |
466 | | static constexpr auto name = "aes_decrypt"; |
467 | | }; |
468 | | |
469 | 8 | void register_function_encryption(SimpleFunctionFactory& factory) { |
470 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
471 | 8 | EncryptionAndDecryptTwoImpl<EncryptImpl, EncryptionMode::SM4_128_ECB, true>, |
472 | 8 | SM4EncryptName>>(); |
473 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
474 | 8 | EncryptionAndDecryptTwoImpl<DecryptImpl, EncryptionMode::SM4_128_ECB, false>, |
475 | 8 | SM4DecryptName>>(); |
476 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
477 | 8 | EncryptionAndDecryptTwoImpl<EncryptImpl, EncryptionMode::AES_128_ECB, true>, |
478 | 8 | AESEncryptName>>(); |
479 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
480 | 8 | EncryptionAndDecryptTwoImpl<DecryptImpl, EncryptionMode::AES_128_ECB, false>, |
481 | 8 | AESDecryptName>>(); |
482 | | |
483 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
484 | 8 | EncryptionAndDecryptMultiImpl<EncryptImpl, EncryptionMode::SM4_128_ECB, true, true>, |
485 | 8 | SM4EncryptName>>(); |
486 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
487 | 8 | EncryptionAndDecryptMultiImpl<DecryptImpl, EncryptionMode::SM4_128_ECB, false, true>, |
488 | 8 | SM4DecryptName>>(); |
489 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
490 | 8 | EncryptionAndDecryptMultiImpl<EncryptImpl, EncryptionMode::AES_128_ECB, true, false>, |
491 | 8 | AESEncryptName>>(); |
492 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
493 | 8 | EncryptionAndDecryptMultiImpl<DecryptImpl, EncryptionMode::AES_128_ECB, false, false>, |
494 | 8 | AESDecryptName>>(); |
495 | | |
496 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
497 | 8 | EncryptionAndDecryptMultiImpl<EncryptImpl, EncryptionMode::AES_128_GCM, true, false, 5>, |
498 | 8 | AESEncryptName>>(); |
499 | 8 | factory.register_function<FunctionEncryptionAndDecrypt< |
500 | 8 | EncryptionAndDecryptMultiImpl<DecryptImpl, EncryptionMode::AES_128_GCM, false, false, |
501 | 8 | 5>, |
502 | 8 | AESDecryptName>>(); |
503 | 8 | } |
504 | | |
505 | | } // namespace doris |