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

 ##########
 File path: 
sql/core/src/test/resources/sql-tests/results/typeCoercion/native/decimalPrecision.sql.out
 ##########
 @@ -1041,37 +1033,33 @@ cannot resolve '(CAST('2017-12-11 09:30:00.0' AS 
TIMESTAMP) - CAST(1 AS DECIMAL(
 -- !query 125
 SELECT cast('2017-12-11 09:30:00' as date) - cast(1 as decimal(3, 0)) FROM t
 -- !query 125 schema
-struct<>
+struct<date_sub(CAST(2017-12-11 09:30:00 AS DATE), CAST(CAST(1 AS 
DECIMAL(3,0)) AS INT)):date>
 -- !query 125 output
-org.apache.spark.sql.AnalysisException
-cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) - CAST(1 AS 
DECIMAL(3,0)))' due to data type mismatch: differing types in 
'(CAST('2017-12-11 09:30:00' AS DATE) - CAST(1 AS DECIMAL(3,0)))' (date and 
decimal(3,0)).; line 1 pos 7
+2017-12-10
 
 
 -- !query 126
 SELECT cast('2017-12-11 09:30:00' as date) - cast(1 as decimal(5, 0)) FROM t
 -- !query 126 schema
-struct<>
+struct<date_sub(CAST(2017-12-11 09:30:00 AS DATE), CAST(CAST(1 AS 
DECIMAL(5,0)) AS INT)):date>
 -- !query 126 output
-org.apache.spark.sql.AnalysisException
-cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) - CAST(1 AS 
DECIMAL(5,0)))' due to data type mismatch: differing types in 
'(CAST('2017-12-11 09:30:00' AS DATE) - CAST(1 AS DECIMAL(5,0)))' (date and 
decimal(5,0)).; line 1 pos 7
+2017-12-10
 
 
 -- !query 127
 SELECT cast('2017-12-11 09:30:00' as date) - cast(1 as decimal(10, 0)) FROM t
 -- !query 127 schema
-struct<>
+struct<date_sub(CAST(2017-12-11 09:30:00 AS DATE), CAST(CAST(1 AS 
DECIMAL(10,0)) AS INT)):date>
 -- !query 127 output
-org.apache.spark.sql.AnalysisException
-cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) - CAST(1 AS 
DECIMAL(10,0)))' due to data type mismatch: differing types in 
'(CAST('2017-12-11 09:30:00' AS DATE) - CAST(1 AS DECIMAL(10,0)))' (date and 
decimal(10,0)).; line 1 pos 7
+2017-12-10
 
 
 -- !query 128
 SELECT cast('2017-12-11 09:30:00' as date) - cast(1 as decimal(20, 0)) FROM t
 
 Review comment:
   No, our date_add/date_sub is werid too, Hive and Postgres only support type 
<=(int4)

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to