GitHub user youngbink opened a pull request: https://github.com/apache/spark/pull/20015
Add new built-in function date_trunc() ## What changes were proposed in this pull request? Adding date_trunc() as a built-in function. date_trunc() is common in other databases, but Spark or Hive does not have support for this. We do have trunc() but this only works with 'MONTH' and 'YEAR' level on the DateType input. date_trunc() in other databases: AWS Redshift: http://docs.aws.amazon.com/redshift/latest/dg/r_DATE_TRUNC.html PostgreSQL: https://www.postgresql.org/docs/9.1/static/functions-datetime.html Presto: https://prestodb.io/docs/current/functions/datetime.html ## How was this patch tested? Unit tests (Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests) (If this patch involves UI changes, please attach a screenshot; otherwise, remove this) Please review http://spark.apache.org/contributing.html before opening a pull request. You can merge this pull request into a Git repository by running: $ git pull https://github.com/youngbink/spark date_trunc Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/20015.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 #20015 ---- commit d84fc0ef0d605ba8944de64d3f6e0ac3d0da5a1b Author: Youngbin Kim <ykim...@hotmail.com> Date: 2017-12-19T01:36:29Z date_trunc support commit f94f401bcfd765b21c3fb466041b42a605d6a814 Author: Youngbin Kim <ykim...@hotmail.com> Date: 2017-12-19T01:53:43Z minor edits: version ---- --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org