Repository navigation
fix: Floor fractional seconds for pre-epoch datetimes - #6979
Open
Hanabi9249 wants to merge 1 commit into
Open
Hanabi9249 wants to merge 1 commit into
Hanabi9249 wants to merge 1 commit into
Conversation
Signed-off-by: Hanabi <3666353208@qq.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6979 +/- ##
==========================================
+ Coverage 49.32% 49.49% +0.16%
==========================================
Files 443 443
Lines 55094 55452 +358
Branches 8017 8085 +68
==========================================
+ Hits 27176 27446 +270
- Misses 26035 26109 +74
- Partials 1883 1897 +14
*This pull request uses carry forward flags. Click here to find out more.
... and 8 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
What this PR does / why we need it:
Feast accepts Python datetime values for UnixTimestamp features. A datetime for 1969-12-31T23:59:59.500000Z was converted to epoch second 0, while the same instant supplied as a Protobuf Timestamp or NumPy datetime64 converted to -1. Truncating a negative fractional timestamp shifts the represented second forward.
Use math.floor for the datetime conversion so the three supported representations agree. Keep the existing handling of naive datetimes as UTC. Add regression tests for representation consistency and whole-second, positive fractional, epoch and null controls.
Validation
On exact source base 9d42729, the new literal regression failed with [0, -1, -1] and the control function passed. On fixed tree 638335fd123448cc0bade4a37107dd6766db32ff, both literal test functions passed, with [-1, -1, -1] and unchanged controls. Each version was executed once. This isolated validation compiled the necessary original source AST definitions and real ValueType enum and used real NumPy 2.4.4 and Protobuf 7.35.0 with the base generated Value definitions, on Python 3.14.1.
Ordinary Feast/type_map imports, pytest collection of the new test file, the full suite, pandas/pyarrow and service integration were not run. Ruff check and Ruff format --check passed once on both changed files using the original SDK configuration with installed Ruff0.16.4, which meets the declared ruff>=0.8.0 requirement. CI-locked Ruff0.16.10 and MyPy were not run; no hosted CI success is claimed.
Scope
Changes are limited to sdk/python/feast/type_map.py and sdk/python/tests/unit/test_unix_timestamp_pre_epoch.py. Collection conversion paths and other timestamp types are outside the executed validation scope.
At publication,
masteris c005dc3. The affectedtype_map.pyis byte-for-byte identical to the tested source before this patch; the new regression path is absent on that master. The accepted patch is unchanged. No claim is made that the whole newer master was tested.Checks
Misc
AI assistance was used for investigation, patch preparation and validation materials. The validation scope and unrun checks are stated above.