Skip to content

feat: expose timestamp nanos as Arrow timestamp(ns)#21

Merged
JingsongLi merged 3 commits into
apache:mainfrom
QuakeWang:align-timestamp-ns-arrow
May 21, 2026
Merged

feat: expose timestamp nanos as Arrow timestamp(ns)#21
JingsongLi merged 3 commits into
apache:mainfrom
QuakeWang:align-timestamp-ns-arrow

Conversation

@QuakeWang
Copy link
Copy Markdown
Contributor

Problem

Mosaic exposes TIMESTAMP precision > 6 as a legacy Arrow Struct (millis, nanos_of_milli) instead of standard Arrow timestamp(ns). This leaks the internal 12-byte storage representation into the Arrow API and loses timezone metadata for TIMESTAMP_LTZ precision > 6.

Fix

Keep the Mosaic file format unchanged, but expose high-precision timestamps through standard Arrow timestamp(ns):

  • Deserialize precision > 6 timestamps as Timestamp(Nanosecond, timezone).
  • Read and write TimestampNanosecondArray using the existing millis + nanos_of_milli storage encoding.
  • Preserve TIMESTAMP_LTZ timezone metadata.
  • Keep legacy Struct input compatibility with validation.
  • Add Rust, Python, C++, and Java timestamp(ns) roundtrip coverage.

Precision 7/8 is normalized to Arrow timestamp(ns), since Arrow does not preserve decimal timestamp precision separately.

QuakeWang and others added 3 commits May 20, 2026 23:58
@JingsongLi
Copy link
Copy Markdown
Contributor

+1

@JingsongLi JingsongLi merged commit 63ed438 into apache:main May 21, 2026
5 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