-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Fix 'Illegal instant due to time zone offset transition' #18010
Conversation
client/trino-jdbc/src/test/java/io/trino/jdbc/BaseTestJdbcResultSet.java
Show resolved
Hide resolved
client/trino-jdbc/src/main/java/io/trino/jdbc/AbstractTrinoResultSet.java
Outdated
Show resolved
Hide resolved
client/trino-jdbc/src/main/java/io/trino/jdbc/AbstractTrinoResultSet.java
Outdated
Show resolved
Hide resolved
de17e30
to
a3efb92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
% comment
client/trino-jdbc/src/main/java/io/trino/jdbc/AbstractTrinoResultSet.java
Show resolved
Hide resolved
a3efb92
to
58735c8
Compare
There was a problem hiding this 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?
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()); |
There was a problem hiding this comment.
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
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: