Visitar URL original
fix: Floor fractional seconds for pre-epoch datetimes by Hanabi9249 · Pull Request #6979 · feast-dev/feast · GitHub
Skip to content

fix: Floor fractional seconds for pre-epoch datetimes - #6979

Open
Hanabi9249 wants to merge 1 commit into
feast-dev:masterfrom
Hanabi9249:codex/unix-timestamp-pre-epoch
Open

Hanabi9249 wants to merge 1 commit into
feast-dev:masterfrom
Hanabi9249:codex/unix-timestamp-pre-epoch

Conversation

@Hanabi9249

Copy link
Copy Markdown
Contributor

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, master is c005dc3. The affected type_map.py is 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

  • Ordinary unit tests and pytest collection are passing (not run; isolated validation described above)
  • My commit is signed off with the exact commit author name and email
  • My PR title follows conventional commits

Misc

AI assistance was used for investigation, patch preparation and validation materials. The validation scope and unrun checks are stated above.

Signed-off-by: Hanabi <3666353208@qq.com>
@Hanabi9249
Hanabi9249 requested a review from a team as a code owner October 8, 2026 20:24
@Hanabi9249 Hanabi9249 changed the title fix: floor pre-epoch datetime Unix timestamp values fix: Floor fractional seconds for pre-epoch datetimes Oct 8, 2026
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.49%. Comparing base (9d42729) to head (ff2a3f0).
⚠️ Report is 8 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ *Carryforward flag
go-feature-server 30.58% <ø> (ø) Carriedforward from 9d42729
python-unit 50.89% <100.00%> (+0.17%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
sdk/python/feast/type_map.py 64.64% <100.00%> (+0.28%) ⬆️

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9d42729...ff2a3f0. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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