gengliangwang commented on a change in pull request #33640: URL: https://github.com/apache/spark/pull/33640#discussion_r683187391
########## File path: sql/core/src/test/resources/sql-tests/inputs/timestamp_ltz.sql ########## @@ -0,0 +1,31 @@ +-- timestamp_ltz literals and constructors +--CONFIG_DIM1 spark.sql.timestampType=TIMESTAMP_LTZ +--CONFIG_DIM1 spark.sql.timestampType=TIMESTAMP_NTZ + +select timestamp_ltz'2016-12-31 00:12:00', timestamp_ltz'2016-12-31'; + +select to_timestamp_ltz(null), to_timestamp_ltz('2016-12-31 00:12:00'), to_timestamp_ltz('2016-12-31', 'yyyy-MM-dd'); +-- `to_timestamp_ltz` can also take date input +select to_timestamp_ltz(to_date(null)), to_timestamp_ltz(to_date('2016-12-31')); +-- `to_timestamp_ltz` can also take timestamp_ntz input +select to_timestamp_ltz(to_timestamp_ntz(null)), to_timestamp_ltz(to_timestamp_ntz('2016-12-31 00:12:00')); + +-- TimestampLTZ numeric fields constructor +SELECT make_timestamp_ltz(2021, 07, 11, 6, 30, 45.678); +SELECT make_timestamp_ltz(2021, 07, 11, 6, 30, 45.678, 'CET'); +SELECT make_timestamp_ltz(2021, 07, 11, 6, 30, 60.007); + +-- [SPARK-31710] TIMESTAMP_SECONDS, TIMESTAMP_MILLISECONDS and TIMESTAMP_MICROSECONDS that always create timestamp_ltz +select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null); Review comment: shall we move these test cases to `timestamp.sql`? So that this file is only for the functions with `_ltz` and developer can have better judgment where the new cases should be. Also, there are overflow test cases below. Even though the current behavior is not related to ANSI mode, we had better check the ANSI mode as well. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org