Repository navigation
fix: Keep null values of the latest row in deduplicate_keep_latest - #7050
Open
ShryukGrandhi wants to merge 1 commit into
Open
ShryukGrandhi wants to merge 1 commit into
ShryukGrandhi wants to merge 1 commit into
Conversation
Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>
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:
deduplicate_keep_latestis supposed to keep the latest row per entity. It usedgroupby(entity_keys).first(), which takes the first non-null value per column. When the latest row had a null feature (e.g. tiledstd/varover a window with fewer than two events), that column was filled from an older row, so stale values got written to the online store by the Spark and Ray compute engines.This change sorts by timestamp and then uses
drop_duplicates(subset=entity_keys, keep="first"), so the latest row is kept unchanged, nulls included.Which issue(s) this PR fixes:
Fixes #7049
Checks
git commit -s)Testing Strategy
Added
test_deduplicate_keep_latest_keeps_null_values_of_latest_rowtosdk/python/tests/unit/test_aggregation_ops.py. It fails on master (the NaN gets replaced with the older2.5) and passes with this fix. The rest oftest_aggregation_ops.pyand the local compute engine unit tests pass, and ruff check/format are clean.