Skip to content
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

Merged
merged 1 commit into from
Sep 2, 2020

Conversation

martint
Copy link
Member

@martint martint commented Aug 20, 2020

Fixes #191, too.

@martint martint added the WIP label Aug 20, 2020
@cla-bot cla-bot bot added the cla-signed label Aug 20, 2020
@martint martint force-pushed the timetz-parametric branch 12 times, most recently from f21202d to 0670ff6 Compare August 24, 2020 17:06
@martint martint removed the WIP label Aug 24, 2020
@martint martint changed the title [WIP] Implement variable-precision TIME WITH TIME ZONE Implement variable-precision TIME WITH TIME ZONE Aug 24, 2020
@martint martint requested a review from dain August 24, 2020 17:08
@martint martint force-pushed the timetz-parametric branch 2 times, most recently from 6c05328 to 205ec48 Compare August 27, 2020 19:10
Copy link
Member

@dain dain left a 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.


private final int precision;

public static TimeWithTimeZoneType createTimeWithTimeZoneType(int precision)
Copy link
Member

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.

/**
* Normalize to offset +00:00. The calculation is done modulo 24h
*/
static long normalize(long picos, int offsetMinutes)
Copy link
Member

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

@martint martint force-pushed the timetz-parametric branch 6 times, most recently from 2eee5c3 to 7624a42 Compare September 2, 2020 16:39
@martint martint closed this Sep 2, 2020
@martint martint deleted the timetz-parametric branch September 2, 2020 16:39
@martint martint merged commit 9474616 into trinodb:master Sep 2, 2020

long nanos = rescale(floorMod(epochMillis, MILLISECONDS_PER_DAY), 3, 9);

return packTimeWithTimeZone(nanos, DateTimes.getOffsetMinutes(Instant.ofEpochMilli(epochMillis), zoneKey));
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Remove support for political time zones from TIME WITH TIME ZONE
3 participants