Repository navigation
fix: Keep the source event timestamp separate from request data in Dask retrieval - #7177
Conversation
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7177 +/- ##
==========================================
+ Coverage 53.70% 53.82% +0.12%
==========================================
Files 462 462
Lines 58556 58639 +83
Branches 8637 8651 +14
==========================================
+ Hits 31447 31562 +115
+ Misses 24972 24938 -34
- Partials 2137 2139 +2
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
franciscojavierarceo
left a comment
There was a problem hiding this comment.
we need the required universal retrieval regression before merging this change.
| ) | ||
| store.apply([entity, *feature_views]) | ||
| return store | ||
|
|
There was a problem hiding this comment.
these cases exercise the public API but hard-code the file store, so they do not check the retrieval contract across the universal store matrix. the component rule requires a universal integration regression when retrieval behavior changes. we need to add the timestamp-name collision to test_universal_historical_retrieval.py using its source/store fixtures, checking the latest eligible feature value and unchanged request columns with both feature-name modes.
There was a problem hiding this comment.
Added in bb0ca85: test_historical_features_with_request_column_named_like_timestamp_field in test_universal_historical_retrieval.py, using its source and store fixtures. The source's timestamp_field is feature_timestamp, and the entity dataframe has its own feature_timestamp request column (later than, earlier than and between the source rows). The test checks the latest eligible feature value for each request and that the request columns come back unchanged, with and without full feature names. Without the fix it fails on the file store (the request column is dropped and feature_timestamp__ is added); with it, it passes on the file and DuckDB stores.
franciscojavierarceo
left a comment
There was a problem hiding this comment.
the added universal regression exposes a Ray point-in-time failure that needs to be handled before merging.
| ) | ||
| store.apply([driver, trips_fv]) | ||
|
|
||
| actual_df = store.get_historical_features( |
There was a problem hiding this comment.
the new universal case fails in Ray CI in both feature-name modes: expected [20, 20, 40], actual [30.0, nan, 40.0]. Ray uses the request's feature_timestamp as the cutoff when that column exists, so the first result comes from after event_timestamp. this exposes an existing Ray bug, but leaves the new suite red. we need to fix that path or narrowly mark this known Ray failure with a tracked issue while preserving the file-store assertions.
There was a problem hiding this comment.
Thanks! I checked it, and the Ray failure isn't caused by this PR. Running the new test on master without the Dask change, Ray gives the same [30.0, nan, 40.0] (Ray 2.58.0), and 0.68.0 does the same. I've opened #7190 for it.
In 796e6b1 I marked only the Ray case as a known failure (xfail(strict=True), linking #7190), so the file-store and DuckDB assertions are unchanged, and the test will turn red again once Ray is fixed, as a reminder to remove the mark. The Ray offline suite now gives 52 passed, 2 xfailed, 4 skipped (CI had 52 passed, 2 failed).
I'm happy to fix the Ray path in a follow-up PR.
…sk retrieval When the entity dataframe had a column named like a feature view's source timestamp_field, the merge suffixed the source column, so the TTL filter, the created-timestamp cutoff, deduplication and the column drop read the request's column instead. Features came back missing or from after the event timestamp, the request column was dropped, non-timestamp values raised, and a request with both ts and ts__ failed or kept allocating memory. Keep the source timestamp under an unused temporary name, as feast-dev#7071 does for the created timestamp column. Signed-off-by: Manoj Kumar Thapa <iammanoj807@gmail.com>
…universal retrieval Signed-off-by: Manoj Kumar Thapa <iammanoj807@gmail.com>
…own failure The Ray offline store uses an entity dataframe column named like the source timestamp field as the point-in-time cutoff (feast-dev#7190). Mark only the Ray case as a strict xfail so the file and DuckDB assertions still run. Signed-off-by: Manoj Kumar Thapa <iammanoj807@gmail.com>
994ede4 to
331281d
Compare
What this PR does / why we need it:
In the file (Dask) offline store,
get_historical_featuresmerges each feature view's source data into the entity dataframe withsuffixes=("", "__"). When the entity dataframe already has a column named like the source'stimestamp_field, the source column becomes<name>__, but the TTL filter, the created-timestamp cutoff, deduplication and the final column drop all keep using<name>, which is now the request's column. As a result:<name>__;AttributeError: 'str' object has no attribute 'tzinfo';tsandts__raisesDuplicate column names found, or, with two feature views usingts, keeps allocating memory.#7071 fixed this for the source's
created_timestamp_columnby keeping it under a temporary name. This PR does the same fortimestamp_field, through a small_unused_column_namehelper now shared by both renames. Because the check runs after_field_mapping, it also covers its__<event timestamp>alias when the request has a column with that name.Adds
test_dask_timestamp_field_collision.py(22 tests, through the publicFeatureStoreAPI with local Parquet files, like #7071's tests):full_feature_namesandfilter_by_created_timestamp, next to request columns that take the temporary names;__event_timestampalias;tsandts__in the request.On master, the first 21 fail (9 missing values, 4 values from after the event timestamp, 8 errors) and the last one runs out of memory. All pass with this change.
Also adds
test_historical_features_with_request_column_named_like_timestamp_fieldto the universal historical retrieval tests, so the case runs on every universal offline store. The source'stimestamp_fieldisfeature_timestamp, and the entity dataframe has its ownfeature_timestamprequest column (later than, earlier than and between the source rows). It checks the latest eligible feature value for each request and that the request columns come back unchanged, with and without full feature names.Which issue(s) this PR fixes:
Fixes #7176
Checks
git commit -s)Testing Strategy
Misc
Run locally:
get_historical_featuresor the Dask store: the same results as master, plus the 22 new tests. The failures and errors are the same on master (optional dependencies not installed locally: Spark, Trino, Postgres, MLflow, Lance).sdk/python/tests/integration/offline_store): 94 passed and 5 skipped, which is the 90 that pass without the new test plus its 4 cases. Without the fix, the new test fails on the file store (the request column is dropped andfeature_timestamp__is added) and passes on DuckDB.test_dqm_validation.pyis not collected locally.dask.py.get_historical_featurescalls on the file store, with 1–3 feature views per call (timestamp fieldsts,feature_tsandevent_timestamp; with and without created columns; TTL set, 0 and unset), bothfull_feature_namessettings, bothfilter_by_created_timestampsettings, and request columns named like the source timestamp and created columns, their temporary names, feature names and other labels, holding UTC, naive, string, integer and float values.Duplicate column namethere), and 2 have request rows sharing a join key and timestamp (fix: Preserve distinct entity_df rows sharing a join key and timestamp in Dask offline store #6786).