Skip to content

expr: fix date_bin off-by-one for sources exactly on a bin boundary before origin#36661

Open
def- wants to merge 1 commit into
MaterializeInc:mainfrom
def-:pr-date_bin
Open

expr: fix date_bin off-by-one for sources exactly on a bin boundary before origin#36661
def- wants to merge 1 commit into
MaterializeInc:mainfrom
def-:pr-date_bin

Conversation

@def-
Copy link
Copy Markdown
Contributor

@def- def- commented May 21, 2026

When source < origin and tm_diff was an exact multiple of the stride, the unconditional tm_delta -= stride_ns shifted the result back a whole extra bin. Also use checked_sub so that the i64::MIN nanosecond boundary surfaces DateBinOutOfRange instead of silently wrapping.

…efore origin

When `source < origin` and `tm_diff` was an exact multiple of the stride,
the unconditional `tm_delta -= stride_ns` shifted the result back a whole
extra bin. Also use `checked_sub` so that the `i64::MIN` nanosecond
boundary surfaces `DateBinOutOfRange` instead of silently wrapping.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@def- def- requested a review from DAlperin May 21, 2026 02:30
@def- def- requested a review from a team as a code owner May 21, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant