cloud-fan commented on a change in pull request #33707:
URL: https://github.com/apache/spark/pull/33707#discussion_r686912483



##########
File path: sql/core/src/test/resources/sql-tests/results/ansi/date.sql.out
##########
@@ -555,28 +589,68 @@ NULL
 
 
 -- !query
-select date '2001-10-01' - date '2001-09-28'
+select date_str - date '2001-09-28' from date_view
 -- !query schema
-struct<(DATE '2001-10-01' - DATE '2001-09-28'):interval day>
+struct<>
 -- !query output
-3 00:00:00.000000000
+org.apache.spark.sql.AnalysisException
+cannot resolve '(date_view.date_str - DATE '2001-09-28')' due to data type 
mismatch: argument 1 requires date type, however, 'date_view.date_str' is of 
string type.; line 1 pos 7
+
+
+-- !query
+select date '2001-09-28' - date_str from date_view
+-- !query schema
+struct<>
+-- !query output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(DATE '2001-09-28' - date_view.date_str)' due to data type 
mismatch: differing types in '(DATE '2001-09-28' - date_view.date_str)' (date 
and string).; line 1 pos 7
 
 
 -- !query
-select '2011-11-11 11:11:11' - date'2011-11-11'
+select date'2011-11-11' + '1'
 -- !query schema
-struct<(2011-11-11 11:11:11 - DATE '2011-11-11'):interval day>
+struct<>
 -- !query output
-0 00:00:00.000000000
+org.apache.spark.sql.AnalysisException
+cannot resolve 'date_add(DATE '2011-11-11', CAST('1' AS DATE))' due to data 
type mismatch: argument 2 requires (int or smallint or tinyint) type, however, 
'CAST('1' AS DATE)' is of date type.; line 1 pos 7
 
 
 -- !query
-select str - date'2011-11-11' from v2
+select '1' + date'2011-11-11'
 -- !query schema
 struct<>
 -- !query output
 org.apache.spark.sql.AnalysisException
-cannot resolve '(v2.str - DATE '2011-11-11')' due to data type mismatch: 
argument 1 requires date type, however, 'v2.str' is of string type.; line 1 pos 
7
+cannot resolve 'date_add(CAST('1' AS DATE), DATE '2011-11-11')' due to data 
type mismatch: argument 2 requires (int or smallint or tinyint) type, however, 
'DATE '2011-11-11'' is of date type.; line 1 pos 7
+
+
+-- !query
+select date'2011-11-11' + null

Review comment:
       This should follow string literal and fail, cc @gengliangwang 




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

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to