Skip to content

Fix 'Illegal instant due to time zone offset transition' #18010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

wendigo
Copy link
Contributor

@wendigo wendigo commented Jun 22, 2023

Description

Fixes #6242

Additional context and related issues

Release notes

( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Jun 22, 2023
@wendigo wendigo requested a review from kokosing June 22, 2023 11:18
@github-actions github-actions bot added the jdbc Relates to Trino JDBC driver label Jun 22, 2023
@kokosing kokosing requested a review from findepi June 23, 2023 22:21
@wendigo wendigo force-pushed the serafin/test-illegal-instant-for-date branch 2 times, most recently from de17e30 to a3efb92 Compare June 25, 2023 13:55
@wendigo wendigo requested a review from kokosing June 26, 2023 12:05
Copy link
Member

@kokosing kokosing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

% comment

@wendigo wendigo requested a review from hashhar June 27, 2023 09:39
@wendigo wendigo force-pushed the serafin/test-illegal-instant-for-date branch from a3efb92 to 58735c8 Compare June 27, 2023 10:13
@wendigo wendigo requested a review from kokosing June 27, 2023 10:13
Copy link
Member

@kokosing kokosing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@electrum would you like to take a look?

@kokosing kokosing merged commit 6cf1e94 into trinodb:master Jul 3, 2023
@github-actions github-actions bot added this to the 421 milestone Jul 3, 2023
@wendigo wendigo deleted the serafin/test-illegal-instant-for-date branch July 3, 2023 09:29
catch (IllegalInstantException ignored) {
// https://joda-time.sourceforge.net/faq.html#illegalinstant
LocalDate localDate = DATE_FORMATTER.parseLocalDate(String.valueOf(value));
return new Date(localDate.toDateTimeAtStartOfDay(localTimeZone).getMillis());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • shouldn't this be done only if millis >= START_OF_MODERN_ERA_SECONDS * MILLISECONDS_PER_SECOND?
    the code block below is supposed to be handling !(millis >= START_OF_MODERN_ERA_SECONDS * MILLISECONDS_PER_SECOND) cases, but it's no longer the case

  • why do we parse with two different ways? can't we use DATE_FORMATTER.parseLocalDate always?
    if there is a good reason for this, there should be a code comment explaining it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed jdbc Relates to Trino JDBC driver
Development

Successfully merging this pull request may close these issues.

ResultSet.getDate fails when there is JVM time zone offset forward change at midnight
3 participants