Skip to content

fix(arrow/array/arreflect): reject unrepresentable timestamps - #1123

Merged
zeroshade merged 2 commits into
apache:mainfrom
fallintoplace:fix/arreflect-timestamp-range
Aug 14, 2026
Merged

fix(arrow/array/arreflect): reject unrepresentable timestamps#1123
zeroshade merged 2 commits into
apache:mainfrom
fallintoplace:fix/arreflect-timestamp-range

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

arreflect converts time.Time values through UnixNano for every timestamp unit. Dates outside the nanosecond range can therefore wrap instead of reporting that the value is not representable.

What changes are included in this PR?

Use the target timestamp unit during conversion and check the integer range before appending the value.

Are these changes tested?

  • go test ./arrow/array/arreflect
  • go test ./arrow -run 'TestTimestamp|TestDate'

Are there any user-facing changes?

Unrepresentable time.Time values now return an error instead of producing a wrapped timestamp.

@fallintoplace
fallintoplace marked this pull request as ready for review August 12, 2026 22:42

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The boundary math is exactly right — including the tricky truncated-division min case where MinInt64 sits one second below MinInt64/multiplier with a fractional offset. The per-unit boundary tests at ±1 unit around MaxInt64/MinInt64 and the negative fractional-second cases give me full confidence. Good fix.


This review was drafted with the help of an AI-assisted tool and may contain mistakes; it was reviewed and confirmed by an Apache Arrow maintainer before posting. See the contributing guide for what the project considers a maintainer review.

@zeroshade zeroshade closed this Aug 14, 2026
@zeroshade zeroshade reopened this Aug 14, 2026
@zeroshade
zeroshade merged commit c5445fb into apache:main Aug 14, 2026
23 checks passed
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.

2 participants