You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/03/28 22:22:30 UTC
[GitHub] [spark] MaxGekk edited a comment on issue #24185:
[SPARK-27252][SQL] Make current_date() independent from time zones
MaxGekk edited a comment on issue #24185: [SPARK-27252][SQL] Make current_date() independent from time zones
URL: https://github.com/apache/spark/pull/24185#issuecomment-477755928
Just to make consequences of the changes clear:
1. `current_date()` will **always** produce current date as a value of `DateType` in the `UTC` time zone.
2. All available conversions of `DateType` to `StringType` is time zone independent in Spark at the moment. See the comment: https://github.com/apache/spark/pull/24181#discussion_r269092290 . Produced strings are **always** textual representation of dates in the UTC time zone.
To take the current date in local time zone (defined by `spark.sql.session.timeZone`), `DATE` column can be casted to `TIMESTAMP` column, and former one can be converted `STRING` column. This works because `TimestampType` to `StringType` is time zone dependent. For example:
```sql
select date_format(cast(current_date as TIMESTAMP), 'yyyy-MM-dd')
```
or with implicit conversion:
```sql
select date_format(current_date, 'yyyy-MM-dd')
```
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org