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