zclllyybb commented on code in PR #56659:
URL: https://github.com/apache/doris/pull/56659#discussion_r2562824404
##########
regression-test/suites/query_p0/sql_functions/datetime_functions/test_date_function.groovy:
##########
@@ -589,8 +601,50 @@ suite("test_date_function") {
CREATE TABLE IF NOT EXISTS ${tableName} (k1 datetimev2(6))
duplicate key(k1) distributed by hash(k1) buckets 1
properties('replication_num' = '1');
"""
sql """ insert into ${tableName} values('1999-01-02 10:11:12.767891') """
+ sql """ insert into ${tableName} values('2023-05-15 08:30:45.123456') """
+ sql """ insert into ${tableName} values('2024-01-01 00:00:00.000001') """
+ sql """ insert into ${tableName} values('2024-12-31 23:59:59.999999') """
- qt_sql """ select microsecond(k1) from ${tableName}; """
+ qt_sql """ select microsecond(k1) from ${tableName} order by k1; """
+
+ // Test microsecond extraction from different datetime formats
+ qt_sql """ select microsecond(k1), k1 from ${tableName} where
microsecond(k1) > 500000 order by k1; """
+ qt_sql """ select microsecond(k1), k1 from ${tableName} where
microsecond(k1) < 100000 order by k1; """
+
+ // Simple tests for basic functionality
+ qt_sql_second_simple """ select second('12:34:56') """
+ // qt_sql_microsecond_simple """ select microsecond('12:34:56.123456') """
+
+ // Test with datetime values
+ qt_sql_second_datetime_with_micro """ select second('2024-01-01
12:34:56.789') """
+ qt_sql_microsecond_datetime_with_micro """ select microsecond('2024-01-01
12:34:56.789123') """
+
+ // Test SECOND and MICROSECOND functions with table containing time_str
column
+ tableName = "test_time_str_functions"
+ sql """ DROP TABLE IF EXISTS ${tableName} """
+ sql """
+ CREATE TABLE IF NOT EXISTS ${tableName} (
+ `id` INT NOT NULL COMMENT "ID",
+ `time_str` VARCHAR(50) NOT NULL COMMENT "时间字符串"
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`id`)
+ DISTRIBUTED BY HASH(`id`) BUCKETS 1
+ PROPERTIES("replication_num" = "1");
+ """
+
+ // Insert key test data
+ sql """ insert into ${tableName} values
+ (1, '120000.12'),
+ (2, '12:00:01.12'),
+ (3, '23:59:59.999999'),
+ (4, '2024-01-01 12:34:56.789123');
+ """
+
+ // Test SECOND function with time_str column
+ // qt_sql_table_second_all """ select second(time_str) from ${tableName}
order by id; """
Review Comment:
这2个case为啥不跑了呢?
--
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]