lszskye opened a new pull request, #2609:
URL: https://github.com/apache/orc/pull/2609
<!--
Thanks for sending a pull request! Here are some tips for you:
1. File a JIRA issue first and use it as a prefix of your PR title, e.g.,
`ORC-001: Fix ABC`.
2. Use your PR title to summarize what this PR proposes instead of
describing the problem.
3. Make PR title and description complete because these will be the
permanent commit log.
4. If possible, provide a concise and reproducible example to reproduce
the issue for a faster review.
5. If the PR is unfinished, use GitHub PR Draft feature.
-->
### What changes were proposed in this pull request?
Moving the compensation to before the timezone conversion, we ensure that
getVariant() always receives the corrected wall-clock time, producing the
correct DST offset and an accurate final result.
### Why are the changes needed?
Previously, the -1 second compensation for pre-1970 timestamps (caused by
Java's truncating integer division in Timestamp.getTime()) was applied after
the writer-to-reader timezone adjustment. This means
writerTimezone.getVariant(writerTime) was called with an uncorrected writerTime
that could be 1 second larger than the true value. If this 1-second discrepancy
happens to cross a DST (Daylight Saving Time) boundary, the timezone lookup
would return an incorrect GMT offset, causing the final timestamp result to be
off by the entire DST shift (typically 1 hour) rather than just 1 second.
### Was this patch authored or co-authored using generative AI tooling?
No
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]