dongjoon-hyun commented on a change in pull request #27965: [SPARK-31205][SQL] 
support string literal as the second argument of date_add/date_sub functions
URL: https://github.com/apache/spark/pull/27965#discussion_r395782473
 
 

 ##########
 File path: docs/sql-migration-guide.md
 ##########
 @@ -113,7 +113,7 @@ license: |
 
 ### UDFs and Built-in Functions
 
-  - Since Spark 3.0, the `date_add` and `date_sub` functions only accepts int, 
smallint, tinyint as the 2nd argument, fractional and string types are not 
valid anymore, e.g. `date_add(cast('1964-05-23' as date), '12.34')` will cause 
`AnalysisException`. In Spark version 2.4 and earlier, if the 2nd argument is 
fractional or string value, it will be coerced to int value, and the result 
will be a date value of `1964-06-04`.
+  - Since Spark 3.0, the `date_add` and `date_sub` functions only accept int, 
smallint, tinyint as the 2nd argument, fractional and non-literal string are 
not valid anymore, e.g. `date_add(cast('1964-05-23' as date), 12.34)` will 
cause `AnalysisException`. Note that, string literals are still allowed, but 
Spark will throw Analysis Exception if the string content is not a valid 
integer. In Spark version 2.4 and earlier, if the 2nd argument is fractional or 
string value, it will be coerced to int value, and the result will be a date 
value of `1964-06-04`.
 
 Review comment:
   The new approach looks good.

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