Repository navigation
Preserve calendar dates with UTC midnight encoding - #209
Closed
pengpengyi92 wants to merge 1 commit into
Closed
pengpengyi92 wants to merge 1 commit into
pengpengyi92 wants to merge 1 commit into
Conversation
Signed-off-by: Pengyi Peng <pengpengyi92@users.noreply.github.com>
pengpengyi92
requested review from
gauglertodd,
ptomecek and
timkpaine
as code owners
November 14, 2026 12:40
4 of 6 tasks
Member
|
Thanks for the PR! I've moved to #210 to consolidate and trim |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Encode plain Python
datevalues at UTC midnight rather than local midnight._to_epoch_millis(date(...))currently creates a naive datetime, sotimestamp()uses the host timezone. On a UTC+8 Windows host, insertingdate(2026, 8, 21)into a real Perspectivedatecolumn stores 2026-08-20 instead. The intermediate encoding is1787241600000; the stored date is1787184000000, rather than the expected1787270400000. Pre-1970 dates can also raiseOSErrorthrough the local timestamp path on Windows.Set
tzinfo=UTConly in the plain-date branch. The earlierdatetimebranch is unchanged: aware datetimes still preserve their instant and naive datetimes retain the existing local-time semantics. No dependency, API, table-registration, server-lifecycle or version changes.Regression tests verify scalar encoding, actual native Perspective round trips and
Dashboard.apply, including a leap date and a pre-epoch date, unchanged input rows and non-temporal values. On systems withtime.tzset, the date cases run under UTC, UTC+8 and UTC-5 and restore the original timezone; Windows uses its actual configured timezone. The tests do not replace datetime or Perspective with mocks.This is separate from #208's failed-table registration fix; it changes only the date conversion line, not that PR's table-creation path.
Type of Change
Validation
Base:
d7a553243c2a3a654e3119140df773d1f4695791. Windows, UTC+8, Python 3.12.14, native Perspective 5.6.1, Ray 2.60.0, spaday 0.14.1.tzsetmatrix, full Ray actor/cluster integration, docs lint and distribution build have not been run locally; upstream CI is separate evidence.Checklist
make lint(Python portion passed; docs lint not run)make test(full related selection passed, not all Ray integrations)AI assistance: Codex assisted with investigation, the original patch/tests and self-review. The contributor explicitly authorized DCO sign-off for this contribution after verification. No private code/data is included, and no separate human or maintainer approval is claimed.
Thanks for reviewing! Happy to adjust the date serialization approach if a different calendar-date contract is preferred.