Skip to content

Preserve microsecond precision in Calendar timestamp binding - #913

Merged
staticlibs merged 1 commit into
duckdb:mainfrom
hutiefang76:frank/newten-dd-calendar-20261010-01a11186
Oct 10, 2026
Merged

staticlibs merged 1 commit into
duckdb:mainfrom
hutiefang76:frank/newten-dd-calendar-20261010-01a11186

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

setTimestamp with a Calendar reconstructs the timestamp from epoch milliseconds, so a value ending in .123456 is bound as .123000. Using Timestamp.toInstant preserves the fractional part while retaining the existing Calendar time zone conversion. Tests cover positive and pre-epoch microsecond values, explicit zones, null timestamps and a null Calendar.

Validation on macOS arm64: compiled all Java production and test sources against the existing JNI artifact; ran TestTimestamp (27 tests). New regressions fail against the original Java implementation and pass with this patch. The full official clang-format 11 check passes. Full native and multi-platform CI remain to be run.

AI assistance was used for implementation and source review.

Signed-off-by: hutiefang76 <137664623+hutiefang76@users.noreply.github.com>

@staticlibs staticlibs 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.

Thanks for the PR! Looks good to me.

@staticlibs
staticlibs merged commit 5530823 into duckdb:main Oct 10, 2026
31 of 32 checks passed
staticlibs pushed a commit that referenced this pull request Oct 10, 2026
This is a backport of the PR #913 to `v2.0-cyanoptera` branch.
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