cloud-fan commented on a change in pull request #26412: [SPARK-29774][SQL] Date 
and Timestamp type +/- null should be null as Postgres
URL: https://github.com/apache/spark/pull/26412#discussion_r354162370
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/results/datetime.sql.out
 ##########
 @@ -100,64 +100,294 @@ struct<year(CAST(1500-01-01 AS 
DATE)):int,month(CAST(1500-01-01 AS DATE)):int,da
 
 
 -- !query 11
-select date '2001-09-28' + 7
+select date '2019-01-01\t'
 -- !query 11 schema
-struct<date_add(DATE '2001-09-28', 7):date>
+struct<DATE '2019-01-01':date>
 -- !query 11 output
-2001-10-05
+2019-01-01
 
 
 -- !query 12
-select 7 + date '2001-09-28'
+select timestamp '2019-01-01\t'
 -- !query 12 schema
-struct<date_add(DATE '2001-09-28', 7):date>
+struct<TIMESTAMP '2019-01-01 00:00:00':timestamp>
 -- !query 12 output
-2001-10-05
+2019-01-01 00:00:00
 
 
 -- !query 13
-select date '2001-10-01' - 7
+select timestamp'2011-11-11 11:11:11' + interval '2' day
 -- !query 13 schema
-struct<date_sub(DATE '2001-10-01', 7):date>
+struct<CAST(TIMESTAMP '2011-11-11 11:11:11' + INTERVAL '2 days' AS 
TIMESTAMP):timestamp>
 -- !query 13 output
-2001-09-24
+2011-11-13 11:11:11
 
 
 -- !query 14
-select date '2001-10-01' - date '2001-09-28'
+select timestamp'2011-11-11 11:11:11' - interval '2' day
 -- !query 14 schema
-struct<subtractdates(DATE '2001-10-01', DATE '2001-09-28'):interval>
+struct<CAST(TIMESTAMP '2011-11-11 11:11:11' - INTERVAL '2 days' AS 
TIMESTAMP):timestamp>
 -- !query 14 output
-3 days
+2011-11-09 11:11:11
 
 
 -- !query 15
-select date'2020-01-01' - timestamp'2019-10-06 10:11:12.345678'
+select date'2011-11-11 11:11:11' + interval '2' second
 -- !query 15 schema
-struct<subtracttimestamps(CAST(DATE '2020-01-01' AS TIMESTAMP), TIMESTAMP 
'2019-10-06 10:11:12.345678'):interval>
+struct<CAST(CAST(DATE '2011-11-11' AS TIMESTAMP) + INTERVAL '2 seconds' AS 
DATE):date>
 -- !query 15 output
-2078 hours 48 minutes 47.654322 seconds
+2011-11-11
 
 
 -- !query 16
-select timestamp'2019-10-06 10:11:12.345678' - date'2020-01-01'
+select date'2011-11-11 11:11:11' - interval '2' second
 -- !query 16 schema
-struct<subtracttimestamps(TIMESTAMP '2019-10-06 10:11:12.345678', CAST(DATE 
'2020-01-01' AS TIMESTAMP)):interval>
+struct<CAST(CAST(DATE '2011-11-11' AS TIMESTAMP) - INTERVAL '2 seconds' AS 
DATE):date>
 -- !query 16 output
--2078 hours -48 minutes -47.654322 seconds
+2011-11-10
 
 
 -- !query 17
-select date '2019-01-01\t'
+select '2011-11-11' - interval '2' day
 -- !query 17 schema
-struct<DATE '2019-01-01':date>
+struct<CAST(CAST(2011-11-11 AS TIMESTAMP) - INTERVAL '2 days' AS 
STRING):string>
 
 Review comment:
   OK it's the existing behavior. We can revisit it later.

----------------------------------------------------------------
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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to