Repository navigation
fix: Break event timestamp ties by created timestamp in the Dask offline store - #6952
Open
LuisFigueroaG wants to merge 1 commit into
Open
LuisFigueroaG wants to merge 1 commit into
LuisFigueroaG wants to merge 1 commit into
Conversation
…ine store The Dask offline store sorted by created_timestamp_column and then by timestamp_field in a second pass, relying on that second sort to keep the created timestamp order for rows sharing an event timestamp. sort_values is not stable, so with enough rows the older row could end up last and win the keep="last" deduplication, both in historical retrieval and in pull_latest_from_table_or_query. Sort once by [timestamp_field, created_timestamp_column] instead. Signed-off-by: LuisFigueroaG <luis.h.figueroa.g@gmail.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6952 +/- ##
=======================================
Coverage 49.04% 49.05%
=======================================
Files 433 433
Lines 54308 54304 -4
Branches 7910 7908 -2
=======================================
+ Hits 26637 26640 +3
+ Misses 25790 25785 -5
+ Partials 1881 1879 -2
... and 1 file 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:
When two rows share an event timestamp, Feast is supposed to keep the one with the latest
created_timestamp_column. The Dask offline store did this with two consecutive sorts, first by the created timestamp and then by the event timestamp, and relied on the second sort preserving the order of the first:Dask's
sort_values(and pandas' default quicksort) is not stable, so for tied event timestamps the older row can end up last and windrop_duplicates(keep="last"). With 300 entities, each having two rows with the same event timestamp, 291 came back with the older row. A single partition with 20 entities already returned 12 wrong rows. This affectsget_historical_features(_drop_duplicates) andpull_latest_from_table_or_query(evaluate_offline_job).This sorts once by
[timestamp_field, created_timestamp_column]in both places, including theZeroDivisionErrorfallbacks. Multi-columnsort_valuesis supported by dask since well before thedask>=2024.2.1minimum.Which issue(s) this PR fixes:
No existing issue.
Checks
git commit -s)Testing Strategy
Added
test_dask_created_timestamp_tiebreak.py, coveringget_historical_featuresandpull_latest_from_table_or_querywith 100 entities across 4 partitions. Both tests failed in 5 out of 5 runs on master and pass with this change.ruff format --check,ruff checkandmypypass on the changed files, andsdk/python/tests/unit/infra/offline_stores/passes (291 passed).