You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (Jira)" <ji...@apache.org> on 2020/06/18 11:00:00 UTC

[jira] [Assigned] (SPARK-31982) Spark sequence doesn't handle date increments that cross DST

     [ https://issues.apache.org/jira/browse/SPARK-31982?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Apache Spark reassigned SPARK-31982:
------------------------------------

    Assignee: Apache Spark

> Spark sequence doesn't handle date increments that cross DST
> ------------------------------------------------------------
>
>                 Key: SPARK-31982
>                 URL: https://issues.apache.org/jira/browse/SPARK-31982
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.4.4
>            Reporter: Dave DeCaprio
>            Assignee: Apache Spark
>            Priority: Major
>
> Run the following query with the Spark default time zone set to "America/Chicago"
>  
> {code:java}
> sequence(cast("2011-03-01" as date), cast("2011-05-01" as date), interval 1 month)
> {code}
> The result is:
>  
> {noformat}
> [2011-03-01, 2011-03-31, 2011-04-30]{noformat}
> I've traced the code what happens is that during this month there is daylight savings and so  the time ends up being 11pm on 3/31 instead of midnight on 4/1.
> If you run this with timezone set to GMT or run the sequence functions over months that don't have daylight savings moving forward, it works correctly.
> I think this is because the toLong and from long functions are not using a timezone but timestampAddInterval is.  I think the solution is probably to make everything time zone aware, but maybe you can just always use GMT for timestmapAddInterval. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org