Skip to content

fix(spec): format pre-epoch timestamptz values - #2892

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix-pre-epoch-timestamptz-format
Open

fix(spec): format pre-epoch timestamptz values#2892
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix-pre-epoch-timestamptz-format

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

N/A. Found while auditing temporal conversions for values before the Unix epoch.

What changes are included in this PR?

Formatting a timestamptz immediately before the Unix epoch could panic. The conversion split the value with integer division and remainder, then cast the negative remainder to an unsigned nanosecond value before constructing the timestamp.

This PR uses Chrono timestamp constructors for both microsecond and nanosecond timestamptz values. These constructors normalize negative timestamps correctly and match the conversion already used for timestamps without a timezone.

Are these changes tested?

Yes. A regression test covers display formatting and JSON round trips for values one microsecond and one nanosecond before the Unix epoch.

Validated with:

  • cargo test -p iceberg --lib
  • cargo clippy -p iceberg --lib -- -D warnings

@fallintoplace fallintoplace changed the title fix(spec): handle pre-epoch timestamptz formatting fix(spec): format pre-epoch timestamptz values Jul 25, 2026
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