Conversation
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.
Treat composite keys as a Series of tuples in
get_random_subset(itertuples(index=False, name=None)), matchingprint_referential_integrity, and use that Series for both.unique()and parent-row.isin.Resolves #2943.
get_random_subsetcrashed withAttributeError: 'DataFrame' object has no attribute 'unique'when a relationship used a composite foreign key. That is the reporter'scredit_card_transactionsdemo:sd254_cardsis keyed by['User', 'CARD INDEX'], and the child foreign keys are['User', 'Card']. Indexing the child table with that list returns a DataFrame, which has no.unique().The same Series-only assumption broke parent-row filtering:
DataFrame.isinon a set of tuples does not drop composite keys, so sampling a child of a composite-key parent could keep or drop the wrong parent rows.A single-column key is still a scalar Series, so existing tests stay valid.
Alternative: only special-case
.unique()on a DataFrame, or filter parents with the existing_get_unreferenced_keysmerge (already used by_get_rows_to_drop). The unique-only guard would leave the silentisinbug. Can switch to the merge helper.