Github user bersprockets commented on a diff in the pull request: https://github.com/apache/spark/pull/21169#discussion_r184687634 --- Diff: sql/core/src/test/resources/sql-tests/results/datetime.sql.out --- @@ -82,9 +82,138 @@ struct<a:int,b:int> 1 2 2 3 + -- !query 9 select weekday('2007-02-03'), weekday('2009-07-30'), weekday('2017-05-27'), weekday(null), weekday('1582-10-15 13:10:15') --- !query 3 schema +-- !query 9 schema struct<weekday(CAST(2007-02-03 AS DATE)):int,weekday(CAST(2009-07-30 AS DATE)):int,weekday(CAST(2017-05-27 AS DATE)):int,weekday(CAST(NULL AS DATE)):int,weekday(CAST(1582-10-15 13:10:15 AS DATE)):int> --- !query 3 output +-- !query 9 output 5 3 5 NULL 4 + + +-- !query 10 +select from_utc_timestamp('2015-07-24 00:00:00', 'PST') +-- !query 10 schema +struct<from_utc_timestamp(2015-07-24 00:00:00, PST):timestamp> +-- !query 10 output +2015-07-23 17:00:00 + + +-- !query 11 +select from_utc_timestamp('2015-01-24 00:00:00', 'PST') +-- !query 11 schema +struct<from_utc_timestamp(2015-01-24 00:00:00, PST):timestamp> +-- !query 11 output +2015-01-23 16:00:00 + + +-- !query 12 +select from_utc_timestamp(null, 'PST') +-- !query 12 schema +struct<from_utc_timestamp(CAST(NULL AS TIMESTAMP), PST):timestamp> +-- !query 12 output +NULL + + +-- !query 13 +select from_utc_timestamp('2015-07-24 00:00:00', null) +-- !query 13 schema +struct<from_utc_timestamp(2015-07-24 00:00:00, CAST(NULL AS STRING)):timestamp> +-- !query 13 output +NULL + + +-- !query 14 +select from_utc_timestamp(null, null) +-- !query 14 schema +struct<from_utc_timestamp(CAST(NULL AS TIMESTAMP), CAST(NULL AS STRING)):timestamp> +-- !query 14 output +NULL + + +-- !query 15 +select from_utc_timestamp(cast(0 as timestamp), 'PST') +-- !query 15 schema +struct<from_utc_timestamp(CAST(0 AS TIMESTAMP), PST):timestamp> +-- !query 15 output +1969-12-31 08:00:00 --- End diff -- Since we're adding new SQLConf settings anyway, we could have a "timestamp.hive.compatibility" (or something like that), that is true by default and allows select from_utc_timestamp(cast(0 as timestamp), 'PST') to continue to produce the above answer. However, when false, it would treat 0 as 1970-01-01T00:00:00 UTC, so the above would instead produce the answer '1969-12-31 16:00:00' (which we both agree in the Jira is probably the more correct answer). Just a thought.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org