Repository navigation
Conversation
DateBinFunctionColumnTransformer.convertToTimestamp added Instant.toEpochMilli() and LocalDateTime.getNano() together. The former already contains the whole milliseconds of the second and the latter is the full nanosecond-of-second, so the milliseconds were counted twice and month/year bins started that many milliseconds late. Convert from getEpochSecond() and getNano() instead so each part is counted once. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
DaZuiZui
force-pushed
the
fix/date-bin-month-subsecond-origin
branch
from
November 13, 2026 15:55
a1f5cd5 to
2bca3ad
Compare
2 tasks done
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.
DateBinFunctionColumnTransformer.convertToTimestampcomputed the result astoEpochMilli() + getNano().toEpochMilli()already contains the wholemilliseconds of the second, and
getNano()is the full nanosecond-of-second(0–999_999_999), not the remainder below one millisecond. The intra-second
milliseconds were therefore counted twice, so month/year bins started that many
milliseconds late. For example
date_bin(1mo, time, 500)returned1000for asource of
500and2678401000for2678400500.The fix converts from
Instant.getEpochSecond()andInstant.getNano(), so eachpart of the instant is counted exactly once, for
ms,usandnsprecision.Hour and day bins do not use this helper and are unaffected. Month bins with a
whole-second origin are also unaffected because
getNano()is 0 for them.How to reproduce
Before:
1000and2678401000. After:500and2678400500.Tests
Added cases in
DateBinFunctionTestfor the issue's scenario, a 2024 origin,dateBinStartEnd,nextDateBin, andus/nsprecision with a sub-secondorigin.
🤖 Generated with Claude Code