Repository navigation
Conversation
convertToTimestamp added toEpochMilli() and the full nanosecond-of-second, so a month or year bin boundary that is not an exact second was shifted by those milliseconds. Encode the Instant from its epoch second and nanosecond-of-second instead. Hour and day bins are unchanged. Fixes apache#19264. Signed-off-by: DaZuiZui <y51288033@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #19264.
date_binanddate_bin_gapfillwith a month or year interval shifted a bin boundary later by the whole milliseconds already present inside that second.date_bin(1mo, time, 500)returned1000instead of500.DateBinFunctionColumnTransformer.convertToTimestampaddedtoEpochMilli()and the fullgetNano().toEpochMilli()already contains the whole milliseconds of that second, andgetNano()is the nanosecond-of-second, so those milliseconds were counted twice. The method now encodes theInstantfromgetEpochSecond()andgetNano().The method is private. Its three callers (
dateBin,dateBinStartEnd, and the month step ofdate_bin_gapfill) share it, so the query result and the gap-fill step stay on the same boundary. Hour and day bins use integer arithmetic and are unchanged. A month bin that lands on an exact second is unchanged because the nanosecond-of-second is 0.This PR has:
Key changed/added classes (or packages if there are too many classes) in this PR
DateBinFunctionColumnTransformerDateBinFunctionTest