github-actions[bot] commented on code in PR #61842:
URL: https://github.com/apache/doris/pull/61842#discussion_r3008271697
##########
regression-test/suites/query_p0/sql_functions/datetime_functions/test_date_function.groovy:
##########
@@ -989,6 +1161,79 @@ suite("test_date_function") {
}
}()
+ sql """ DROP TABLE IF EXISTS dt_null; """
+
+ sql """
+ CREATE TABLE IF NOT EXISTS dt_null(
+ `k1` INT NOT NULL,
+ `dtv24` datetimev2(4) NOT NULL,
+ `dtv20n` datetimev2(0) NULL,
+ `dv2` datev2 NOT NULL,
+ `dv2n` datev2 NULL,
+ `str` VARCHAR NULL
+ )
+ DISTRIBUTED BY HASH(`k1`) BUCKETS 5
+ properties("replication_num" = "1"); """
+ sql """ insert into dt_null values ('1', '2020-12-12', '2020-12-12',
'2020-12-12', '2020-12-12', '2020-12-12'),
+ ('2', '2020-12-12 12:12:12', '2020-12-12 12:12:12', '2020-12-12
12:12:12', '2020-12-12 12:12:12', '2020-12-12 12:12:12'),
+ ('3', '2020-12-12 12:12:12.0', '2020-12-12 12:12:12.0',
'2020-12-12 12:12:12.0', '2020-12-12 12:12:12.0', '2020-12-12 12:12:12.0'),
+ ('4', '2020-12-12 12:12:12.123', '2020-12-12 12:12:12.123',
'2020-12-12 12:12:12.123', '2020-12-12 12:12:12.123', '2020-12-12
12:12:12.123'),
+ ('5', '2020-12-12 12:12:12.666666', '2020-12-12 12:12:12.666666',
'2020-12-12 12:12:12.666666', '2020-12-12 12:12:12.666666', '2020-12-12
12:12:12.666666'); """
+
+ qt_sql_dt_null_1 """ select unix_timestamp(dtv24), unix_timestamp(dtv20n),
unix_timestamp(dv2), unix_timestamp(dv2n), unix_timestamp(str) from dt_null
order by k1; """
+
+ sql """ DROP TABLE IF EXISTS dt_timenull; """
+
+ sql """
+ CREATE TABLE IF NOT EXISTS dt_timenull(
+ `k1` INT NOT NULL,
+ `k2` BIGINT NOT NULL
+ )
+ DISTRIBUTED BY HASH(`k1`) BUCKETS 5
+ properties("replication_num" = "1");
+ """
+
+ sql """ insert into dt_timenull values (1, 0),(2, 100),(3, 123),(4,
219837),(5, -8923),(6, -29313),(7, 2131321231),(8, -21312313),(9,1112345);"""
+
+ qt_sql_time_value """ select k1 , cast(k2 as time) , hour(cast(k2 as
time)) , minute(cast(k2 as time)), second(cast(k2 as time)) from dt_timenull
order by k1;"""
Review Comment:
Nit (pre-existing from nereids_p0): This `qt_sql_time_value` label is
duplicated — it appears on this line and again 3 lines below. Only the second
query's result will be validated against the `.out` file, making the first
query effectively unchecked. Consider renaming one (e.g., `qt_sql_time_value_1`
and `qt_sql_time_value_2`).
##########
regression-test/suites/query_p0/sql_functions/encryption_digest/test_encryption_function.groovy:
##########
@@ -74,6 +74,58 @@ suite("test_encryption_function") {
qt_sql "SELECT SM3(\"abc\");"
qt_sql "select sm3(\"abcd\");"
qt_sql "select sm3sum(\"ab\",\"cd\");"
+
+ qt_sql_gcm_1 "SELECT TO_BASE64(AES_ENCRYPT('Spark SQL',
'1234567890abcdef', '123456789012', 'aes_128_gcm', 'Some AAD'))"
+ qt_sql_gcm_2 "SELECT
AES_DECRYPT(FROM_BASE64('MTIzNDU2Nzg5MDEyMdXvR41sJqwZ6hnTU8FRTTtXbL8yeChIZA=='),
'1234567890abcdef', '', 'aes_128_gcm', 'Some AAD')"
+
+ qt_sql_gcm_3 "select
to_base64(aes_encrypt('Spark','abcdefghijklmnop12345678ABCDEFGH',unhex('000000000000000000000000'),'aes_256_gcm',
'This is an AAD mixed into the input'));"
+ qt_sql_gcm_4 "SELECT
AES_DECRYPT(FROM_BASE64('AAAAAAAAAAAAAAAAQiYi+sTLm7KD9UcZ2nlRdYDe/PX4'),
'abcdefghijklmnop12345678ABCDEFGH', '', 'aes_256_gcm', 'This is an AAD mixed
into the input');"
+
+ sql "DROP TABLE IF EXISTS aes_encrypt_decrypt_tbl"
+ sql """
+ CREATE TABLE IF NOT EXISTS aes_encrypt_decrypt_tbl (
+ id int,
+ plain_txt varchar(255),
+ enc_txt varchar(255),
+ k varchar(255),
+ iv varchar(255),
+ mode varchar(255),
+ aad varchar(255)
+ ) DISTRIBUTED BY HASH(id) BUCKETS 1
+ PROPERTIES (
+ "replication_num" = "1"
+ )
+ """
+ sql """ insert into aes_encrypt_decrypt_tbl values(1,'Spark
SQL','MTIzNDU2Nzg5MDEyMdXvR41sJqwZ6hnTU8FRTTtXbL8yeChIZA==','1234567890abcdef','123456789012','aes_128_gcm','Some
AAD');"""
+ sql """ insert into aes_encrypt_decrypt_tbl
values(2,'Spark','AAAAAAAAAAAAAAAAQiYi+sTLm7KD9UcZ2nlRdYDe/PX4','abcdefghijklmnop12345678ABCDEFGH',unhex('000000000000000000000000'),'aes_256_gcm','This
is an AAD mixed into the input');"""
+ sql """ sync """
+
+ qt_sql_gcm_5 "SELECT id,TO_BASE64(AES_ENCRYPT(plain_txt,k,iv,mode,aad))
from aes_encrypt_decrypt_tbl order by id;"
+ qt_sql_gcm_6 "SELECT id,AES_DECRYPT(FROM_BASE64(enc_txt),k,'',mode,aad)
from aes_encrypt_decrypt_tbl order by id;"
+
+ // test for const opt branch, only first column is not const
+ qt_sql_gcm_7 "SELECT id,TO_BASE64(AES_ENCRYPT(plain_txt,
'1234567890abcdef', '123456789012', 'aes_128_gcm', 'Some AAD')) from
aes_encrypt_decrypt_tbl where id=1"
+ qt_sql_gcm_8 "SELECT AES_DECRYPT(FROM_BASE64(enc_txt), '1234567890abcdef',
'', 'aes_128_gcm', 'Some AAD') from aes_encrypt_decrypt_tbl where id=1"
+
+ sql "unset variable block_encryption_mode;"
+ qt_sql_empty1 "select hex(aes_encrypt('', 'securekey456'));"
+ qt_sql_empty2 "select hex(aes_encrypt(rpad('', 16, ''), 'securekey456'));"
+ qt_sql_empty3 "select hex(aes_encrypt(rpad('', 17, ''), 'securekey456'));"
+ qt_sql_empty4 "select hex(sm4_encrypt('', 'securekey456'));"
+ qt_sql_empty5 "select
sm4_decrypt(unhex('0D56319E329CDA9ABDF5870B9D5ACA57'), 'securekey456');"
+
+ test {
Review Comment:
Nit (pre-existing from nereids_p0): The `sql """set
enable_fold_constant_by_be=true """` inside the `test{}` block is
unconventional. In Doris regression framework, the `test{}` block checks the
*last* `sql` for the `exception`. While this works correctly here, the `SET`
statement should ideally be placed *before* the `test{}` block for clarity and
to follow the conventional pattern.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]