Skip to content

Commit

Permalink
[Bug](function) fix encryption_function return wrong result at const …
Browse files Browse the repository at this point in the history
…column (apache#40201)

## Proposed changes

the string object have error of order, should be src, key,iv,mode

<!--Describe your changes.-->
  • Loading branch information
zhangstar333 committed Sep 2, 2024
1 parent 5db2c8b commit 3b625e9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion be/src/vec/functions/function_encryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ struct EncryptionAndDecryptFourImpl {
return Status::OK();
}

static void vector_const(const ColumnString* column, StringRef iv_arg, StringRef key_arg,
static void vector_const(const ColumnString* column, StringRef key_arg, StringRef iv_arg,
StringRef mode_arg, size_t input_rows_count,
ColumnString::Chars& result_data, ColumnString::Offsets& result_offset,
NullMap& null_map) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,6 @@ text
-- !sql --
82ec580fe6d36ae4f81cae3c73f4a5b3b5a09c943172dc9053c69fd8e18dca1e

-- !sql --
aaaaaa

Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,21 @@ suite("test_encryption_function") {
qt_sql "SELECT SM3(\"abc\");"
qt_sql "select sm3(\"abcd\");"
qt_sql "select sm3sum(\"ab\",\"cd\");"
sql "DROP TABLE IF EXISTS quantile_table"
sql"""
CREATE TABLE quantile_table
(
id int,
k string
)
ENGINE=OLAP
UNIQUE KEY(id)
DISTRIBUTED BY HASH(id) BUCKETS 4
PROPERTIES (
"enable_unique_key_merge_on_write" = "true",
"replication_num" = "1"
);
"""
sql""" insert into quantile_table values(1,"aaaaaa");"""
qt_sql """ select sm4_decrypt(sm4_encrypt(k,"doris","0123456789abcdef"),"doris","0123456789abcdef") from quantile_table; """
}

0 comments on commit 3b625e9

Please sign in to comment.