[ 
https://issues.apache.org/jira/browse/SPARK-31982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17139311#comment-17139311
 ] 

Apache Spark commented on SPARK-31982:
--------------------------------------

User 'TJX2014' has created a pull request for this issue:
https://github.com/apache/spark/pull/28856

> 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
>            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-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to