-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Implement variable-precision TIME WITH TIME ZONE #4905
Conversation
f21202d
to
0670ff6
Compare
6c05328
to
205ec48
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.
A bunch of minor comments but otherwise looks good.
presto-jdbc/src/main/java/io/prestosql/jdbc/AbstractPrestoResultSet.java
Show resolved
Hide resolved
presto-jdbc/src/main/java/io/prestosql/jdbc/AbstractPrestoResultSet.java
Outdated
Show resolved
Hide resolved
...in/src/main/java/io/prestosql/operator/scalar/timestamp/TimestampToTimeWithTimezoneCast.java
Outdated
Show resolved
Hide resolved
...in/src/main/java/io/prestosql/operator/scalar/timestamp/TimestampToTimeWithTimezoneCast.java
Outdated
Show resolved
Hide resolved
...in/src/main/java/io/prestosql/operator/scalar/timestamp/TimestampToTimeWithTimezoneCast.java
Outdated
Show resolved
Hide resolved
presto-spi/src/main/java/io/prestosql/spi/type/ShortTimeWithTimeZoneType.java
Outdated
Show resolved
Hide resolved
presto-spi/src/main/java/io/prestosql/spi/type/ShortTimeWithTimeZoneType.java
Outdated
Show resolved
Hide resolved
|
||
private final int precision; | ||
|
||
public static TimeWithTimeZoneType createTimeWithTimeZoneType(int precision) |
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.
Update this to the same style in the other date time types.
presto-spi/src/main/java/io/prestosql/spi/type/TimeWithTimeZoneType.java
Outdated
Show resolved
Hide resolved
/** | ||
* Normalize to offset +00:00. The calculation is done modulo 24h | ||
*/ | ||
static long normalize(long picos, int offsetMinutes) |
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.
we should consider having public "normalize" for short and long in the SPI
2eee5c3
to
7624a42
Compare
7624a42
to
9474616
Compare
|
||
long nanos = rescale(floorMod(epochMillis, MILLISECONDS_PER_DAY), 3, 9); | ||
|
||
return packTimeWithTimeZone(nanos, DateTimes.getOffsetMinutes(Instant.ofEpochMilli(epochMillis), zoneKey)); |
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.
Should this use the zone object that we have above and thus avoid allocation of the Instant
(and further allocations in the getOffsetMinutes
method)?
perhaps this should get same offsetMinutes value:
getChronology(zoneKey).getZone().getOffset(epochMillis) / MILLISECONDS_PER_MINUTE
Fixes #191, too.