Skip to content

fix: handle date_bin negative subsecond and overflow cases#22610

Open
kumarUjjawal wants to merge 2 commits into
apache:mainfrom
kumarUjjawal:fix/date-bin-error-change
Open

fix: handle date_bin negative subsecond and overflow cases#22610
kumarUjjawal wants to merge 2 commits into
apache:mainfrom
kumarUjjawal:fix/date-bin-error-change

Conversation

@kumarUjjawal
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

date_bin had a few edge cases that could return the wrong result, return an error only on array inputs, or panic/wrap when scaling timestamp and time values to nanoseconds.

What changes are included in this PR?

  • Fix negative sub-second timestamp conversion before the epoch.
  • Make scalar and array paths return NULL consistently for per-row binning errors.
  • Use checked scaling when converting timestamp and time values to nanoseconds.
  • Return an error for invalid shared origin values that overflow during scaling.
  • Simplify duplicated stride and scale handling.

Are these changes tested?

Yes

Are there any user-facing changes?

No public API changes.

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels May 29, 2026
@kumarUjjawal kumarUjjawal requested a review from Jefffrey May 29, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

date_bin scalar & array paths have different error behaviours

1 participant