Title: fix: Normalize Dask timestamps to UTC without a row-wise apply by Daksha1611 · Pull Request #6818 · feast-dev/feast · GitHub
Open Graph Title: fix: Normalize Dask timestamps to UTC without a row-wise apply by Daksha1611 · Pull Request #6818 · feast-dev/feast
X Title: fix: Normalize Dask timestamps to UTC without a row-wise apply by Daksha1611 · Pull Request #6818 · feast-dev/feast
Description: What this PR does / why we need it: _normalize_timestamp made timestamp columns tz-aware with a row-wise apply that declared meta=(timestamp_field, "datetime64[ns, UTC]"). meta only declares the dtype — the partition gets whatever the lambda returns. With zero rows the lambda never runs, so the computed column stayed tz-naive while meta claimed UTC, and the tz-aware comparison in _filter_ttl then raised: TypeError: Invalid comparison between dtype=datetime64[ns] and DatetimeArray A zero-row entity_df is a normal case in batch scoring — the upstream query matched nothing for that run — so get_historical_features crashed instead of returning an empty result. While fixing this I found the same mismatch on a second path: a column carrying a non-UTC timezone also diverged from the declared meta, because the lambda returned any value that already had tzinfo untouched. That is covered by a test here too. Both applies are replaced with dd.to_datetime(..., utc=True), which localizes tz-naive values, converts tz-aware ones, and yields the correct dtype for an empty frame. It is also vectorized, so it drops a Python-level call per row on non-empty frames. Which issue(s) this PR fixes: Fixes #6817 Checks I've made sure the tests are passing. My commits are signed off (git commit -s) My PR title follows conventional commits format Testing Strategy Unit tests Integration tests Manual tests Testing is not required for this change New sdk/python/tests/unit/infra/offline_stores/test_dask_empty_entity_df.py covers normalization and TTL filtering at 0 and 1 rows, plus the non-UTC case. Three of its five assertions fail on master and pass here; the two 1-row cases pass both ways, pinning the non-empty behaviour as unchanged. Verified end to end as well: get_historical_features(...).to_df() against a file offline store with an otherwise identical entity frame raised TypeError at 0 rows before this change, and now returns an empty frame with the expected columns while the 1-row case is unchanged. sdk/python/tests/unit/infra/offline_stores plus test_unit_feature_store.py: 235 passed. The 20 errors in that run are MongoDB testcontainers failing to start locally and are present on master too. ruff check, ruff format --check and mypy are clean on both changed files. Misc Point-in-time correctness is unaffected — I re-ran the filter_by_created_timestamp scenario (a row backfilled after the entity timestamp) and it still excludes the late row with the flag and includes it without.
Open Graph Description: What this PR does / why we need it: _normalize_timestamp made timestamp columns tz-aware with a row-wise apply that declared meta=(timestamp_field, "datetime64[ns, UTC]"). meta only decla...
X Description: What this PR does / why we need it: _normalize_timestamp made timestamp columns tz-aware with a row-wise apply that declared meta=(timestamp_field, "datetime64[ns, UTC]"). meta on...
Opengraph URL: https://github.com/feast-dev/feast/pull/6818
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:961c6970-5e44-bd70-9b77-9e5f73853bed |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | ADE4:ECEED:250CF8:332C81:6AFE9565 |
| html-safe-nonce | a7bd43de93afe9363e6bc792f3d623fa93826b502e4853929819100aa58fda72 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBREU0OkVDRUVEOjI1MENGODozMzJDODE6NkFGRTk1NjUiLCJ2aXNpdG9yX2lkIjoiNzY0MTc0MjE4NDM0NDg4NDU4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 65bd62f8154cb74460bd50704ad75a622b5ab70da4e0e2d0870a3c074c4f92c0 |
| hovercard-subject-tag | pull_request:4457638324 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/feast-dev/feast/pull/6818/files |
| twitter:image | https://avatars.githubusercontent.com/u/113719658?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/113719658?s=400&v=4 |
| og:image:alt | What this PR does / why we need it: _normalize_timestamp made timestamp columns tz-aware with a row-wise apply that declared meta=(timestamp_field, "datetime64[ns, UTC]"). meta only decla... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/feast-dev/feast git https://github.com/feast-dev/feast.git |
| octolytics-dimension-user_id | 57027613 |
| octolytics-dimension-user_login | feast-dev |
| octolytics-dimension-repository_id | 161133770 |
| octolytics-dimension-repository_nwo | feast-dev/feast |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 161133770 |
| octolytics-dimension-repository_network_root_nwo | feast-dev/feast |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width