GitHub user windpiger opened a pull request: https://github.com/apache/spark/pull/16870
[SPARK-19496][SQL]to_date udf to return null when input date is invalid ## What changes were proposed in this pull request? Currently the udf `to_date` has different return value with an invalid date input. ``` SELECT to_date('2015-07-22', 'yyyy-dd-MM') -> return `2016-10-07` SELECT to_date('2014-31-12') -> return null ``` As discussed in JIRA [SPARK-19496](https://issues.apache.org/jira/browse/SPARK-19496), we should return null in both situations when the input date is invalid ## How was this patch tested? unit test added You can merge this pull request into a Git repository by running: $ git pull https://github.com/windpiger/spark to_date Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/16870.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #16870 ---- commit 24c99fa4c0ddcdbd852b8d5354aaff43fa198477 Author: windpiger <song...@outlook.com> Date: 2017-02-09T09:58:17Z [SPARK-19496][SQL]to_date udf to return null when input date is invalid ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org