GitHub user davies opened a pull request:
https://github.com/apache/spark/pull/13652
[SPARK-] Fix incorrect days to millis conversion
## What changes were proposed in this pull request?
Internally, we use Int to represent a date (the days since 1970-01-01),
when we convert that into unix timestamp (milli-seconds since epoch in UTC), we
get the offset of a timezone using local millis (the milli-seconds since
1970-01-01 in a timezone), but TimeZone.getOffset() expect unix timestamp, the
result could be off by one hour (in Daylight Saving Time (DST) or not).
This PR change to use best effort approximate of posix timestamp to lookup
the offset. In the event of changing of DST, Some time is not defined (for
example, 2016-03-13 02:00:00 PST), or could lead to multiple valid result in
UTC (for example, 2016-11-06 01:00:00), this best effort approximate should be
enough in practice.
## How was this patch tested?
Added regression tests.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/davies/spark fix_timezone
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/13652.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 #13652
----
commit 20904c4323c5f908a42ea1b4cea6701626cebe28
Author: Davies Liu <[email protected]>
Date: 2016-06-13T22:34:55Z
fix toUTCTime and daysToMillis
----
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]