github-actions[bot] commented on code in PR #61842:
URL: https://github.com/apache/doris/pull/61842#discussion_r3015387996


##########
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 {
+      sql """set enable_fold_constant_by_be=true """

Review Comment:
   **Bug: `test{}` block with two `sql` statements — the `set` is silently 
ignored.**
   
   In the Doris regression test DSL, a `test{}` block accepts only one `sql` 
property. The second `sql` assignment overwrites the first. So `set 
enable_fold_constant_by_be=true` is **never executed** — only the `select 
aes_encrypt(...)` runs.
   
   This means the test does not actually validate the error under BE constant 
folding as intended.
   
   **Fix:** Move the `set` statement outside the `test{}` block:
   ```groovy
   sql """set enable_fold_constant_by_be=true """
   test {
     sql """select aes_encrypt('Constant', '0123456789abcdef0123456789abcdef', 
'AES_128_ECB', '1234567890abcdef');"""
     exception """mode 1234567890ABCDEF is not supported"""
   }
   ```
   Same fix needed for the `aes_decrypt` test block below (line 51+).



##########
regression-test/suites/query_p0/sql_functions/string_functions/test_string_function.groovy:
##########
@@ -112,6 +112,14 @@ suite("test_string_function", "arrow_flight_sql") {
     qt_sql "select money_format(1123.456);"
     qt_sql "select money_format(1123.4);"
     qt_sql "select money_format(truncate(1000,10))"
+    qt_sql "select money_format(1.1249);"
+    qt_sql_decimal32 "select money_format(cast(concat('1.124', repeat('9', 5)) 
as DECIMAL(9, 8)));"
+    qt_sql_decimal64 "select money_format(cast(concat('1.124', repeat('9', 6)) 
as DECIMAL(10, 9)));"
+    qt_sql_decimal64 "select money_format(cast(concat('1.124', repeat('9', 
14)) as DECIMAL(18, 17)));"

Review Comment:
   **Bug: Duplicate `qt_sql_decimal64`, `qt_sql_decimal128`, and 
`qt_sql_float64` tags.**
   
   Each of these tag names appears twice with different queries (e.g., 
`qt_sql_decimal64` on lines 7 and 8 of this hunk). Only the last result for 
each tag will be validated. The first query's result is silently discarded.
   
   **Fix:** Add unique suffixes, e.g. `qt_sql_decimal64_1` / 
`qt_sql_decimal64_2`.



##########
regression-test/suites/query_p0/sql_functions/string_functions/test_string_function.groovy:
##########
@@ -347,6 +355,102 @@ suite("test_string_function", "arrow_flight_sql") {
 
     qt_sql "select sub_replace(\"this is origin str\",\"NEW-STR\",1);"
     qt_sql "select sub_replace(\"doris\",\"***\",1,2);"
+    sql """ set debug_skip_fold_constant = true;"""
+    qt_sub_replace_utf8_sql1 " select sub_replace('你好世界','a',1);"
+    qt_sub_replace_utf8_sql2 " select sub_replace('你好世界','ab',1);"

Review Comment:
   **Bug: Duplicate `qt_sub_replace_utf8_sql*` tags — 
`debug_skip_fold_constant=true` path is not validated.**
   
   Each of `qt_sub_replace_utf8_sql1` through `qt_sub_replace_utf8_sql10` 
appears twice — once under `debug_skip_fold_constant=true` (line 20+) and once 
under `false` (line 31+). The second execution overwrites the first in the 
`.out` file, so only the `false` path is validated.
   
   **Fix:** Use distinct tag names for each code path, e.g. 
`qt_sub_replace_utf8_nofold_sql1` vs `qt_sub_replace_utf8_fold_sql1`.
   
   Also, all 42 `qt_soundex` tags below (lines 43-82) share the same tag name — 
only the last SOUNDEX result is validated.



##########
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:
   **Bug: Duplicate `qt_sql_time_value` tag — two different queries share the 
same tag.**
   
   This `qt_sql_time_value` tag is used here for a multi-row table query, and 
again 3 lines below for a scalar constant query. Only the last result will be 
validated in the `.out` file; this query's result is silently discarded.
   
   **Fix:** Rename one of the tags, e.g. `qt_sql_time_value_table` and 
`qt_sql_time_value_const`.



##########
regression-test/suites/query_p0/sql_functions/conditional_functions/test_if.groovy:
##########
@@ -23,4 +23,30 @@ suite("test_if") {
     qt_select "select if(job_d is null, job_d, array()) as test from (select 
array('1970-01-01', '1970-01-01') as job_d) t"
     qt_select "SELECT NOT ISNULL(CASE WHEN IFNULL ((t1.region IN ('US')),0) 
THEN t1.region ELSE 'other' END) AS account_id, count(*) FROM (select 'US' AS 
region) as t1 group by 1"
     qt_select "SELECT NOT ISNULL(CASE WHEN IFNULL (('US' IN ('US')),0) THEN 
'US' ELSE 'other' END);"
+
+    sql "set debug_skip_fold_constant = true"
+
+    qt_sql """
+    select if(jsonb_exists_path(CAST('{"a":1}' AS json), '\$.b'), 'EXISTS', 
'NOT_EXISTS')

Review Comment:
   **Bug: All 6 newly added queries use the identical bare `qt_sql` tag.**
   
   When multiple `qt_` calls share the same tag name, only the last one's 
result is validated against the `.out` file — the first 5 are silently 
discarded. This means 5 of 6 test cases provide zero coverage.
   
   **Fix:** Use unique tag names, e.g. `qt_sql_if_jsonb1` through 
`qt_sql_if_jsonb6`.



-- 
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]

Reply via email to