diff --git a/be/src/vec/functions/function_timestamp.cpp b/be/src/vec/functions/function_timestamp.cpp index c2285795c7..483f8cf992 100644 --- a/be/src/vec/functions/function_timestamp.cpp +++ b/be/src/vec/functions/function_timestamp.cpp @@ -831,7 +831,7 @@ struct UnixTimeStampStrImpl { std::tie(col_right, format_const) = unpack_if_const(block.get_by_position(arguments[1]).column); - auto col_result = ColumnDecimal::create(input_rows_count, 0); + auto col_result = ColumnDecimal::create(input_rows_count, 6); auto null_map = ColumnVector::create(input_rows_count); auto& col_result_data = col_result->get_data(); auto& null_map_data = null_map->get_data(); diff --git a/regression-test/data/query_p0/sql_functions/datetime_functions/test_date_function.out b/regression-test/data/query_p0/sql_functions/datetime_functions/test_date_function.out index ecf83359db..c05fb8ef53 100644 --- a/regression-test/data/query_p0/sql_functions/datetime_functions/test_date_function.out +++ b/regression-test/data/query_p0/sql_functions/datetime_functions/test_date_function.out @@ -380,6 +380,9 @@ February -- !sql_ustamp7 -- 1196389819.1235 +-- !sql_ustamp8 -- +1704038400 + -- !sql -- 0 diff --git a/regression-test/suites/query_p0/sql_functions/datetime_functions/test_date_function.groovy b/regression-test/suites/query_p0/sql_functions/datetime_functions/test_date_function.groovy index 49db2bb4c8..fd504f0be9 100644 --- a/regression-test/suites/query_p0/sql_functions/datetime_functions/test_date_function.groovy +++ b/regression-test/suites/query_p0/sql_functions/datetime_functions/test_date_function.groovy @@ -441,6 +441,7 @@ suite("test_date_function") { // UNIX_TIMESTAMP def unin_timestamp_str = """ select unix_timestamp() """ assertTrue(unin_timestamp_str[0].size() == 1) + qt_sql_ustamp1 """ select unix_timestamp('2007-11-30 10:30:19') """ qt_sql_ustamp2 """ select unix_timestamp('2007-11-30 10:30-19', '%Y-%m-%d %H:%i-%s') """ qt_sql_ustamp3 """ select unix_timestamp('2007-11-30 10:30%3A19', '%Y-%m-%d %H:%i%%3A%s') """ @@ -448,6 +449,7 @@ suite("test_date_function") { qt_sql_ustamp5 """ select unix_timestamp('2007-11-30 10:30:19.123456') """ qt_sql_ustamp6 """ select unix_timestamp(cast('2007-11-30 10:30:19.123456' as datetimev2(3))) """ qt_sql_ustamp7 """ select unix_timestamp(cast('2007-11-30 10:30:19.123456' as datetimev2(4))) """ + qt_sql_ustamp8 """ select cast(unix_timestamp("2024-01-01",'yyyy-MM-dd') as bigint) """ // UTC_TIMESTAMP def utc_timestamp_str = sql """ select utc_timestamp(),utc_timestamp() + 1 """