cloud-fan commented on a change in pull request #28650: URL: https://github.com/apache/spark/pull/28650#discussion_r431686512
########## File path: sql/core/src/test/resources/sql-tests/inputs/datetime.sql ########## @@ -160,3 +156,83 @@ select from_json('{"time":"26/October/2015"}', 'time Timestamp', map('timestampF select from_json('{"date":"26/October/2015"}', 'date Date', map('dateFormat', 'dd/MMMMM/yyyy')); select from_csv('26/October/2015', 'time Timestamp', map('timestampFormat', 'dd/MMMMM/yyyy')); select from_csv('26/October/2015', 'date Date', map('dateFormat', 'dd/MMMMM/yyyy')); + +select date_format(null, null); +select date_format(null, 'yyyy-MM-dd'); +select date_format(null, 'invalid'); +select date_format(cast(null as date), 'yyyy-MM-dd'); +select date_format(date '1986-05-23', null); +select date_format(date '1986-05-23', 'invalid'); +select date_format(date '1986-05-23', 'yyyy-MM-dd'); +select date_format(cast(null as string), 'yyyy-MM-dd'); +select date_format('1986-05-23', null); +select date_format('1986-05-23', 'invalid'); +select date_format('1986-05-23', 'yyyy-MM-dd'); +select date_format(cast(null as timestamp ), 'yyyy-MM-dd'); +select date_format(timestamp '1986-05-23', null); +select date_format(timestamp '1986-05-23', 'invalid'); +select date_format(timestamp '1986-05-23', 'yyyy-MM-dd'); + +select from_unixtime(null); +select from_unixtime(null , null); +select from_unixtime(12345 , null); +select from_unixtime(null , 'invalid'); +select from_unixtime(null , 'yyyy-MM-dd'); +select from_unixtime(12345 , 'yyyy-MM-dd'); + +-- select unix_timestamp(); disabled because nondeterministic Review comment: shall we remove it? ---------------------------------------------------------------- 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. 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