Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't include runs when merging collections #2030

Merged
merged 2 commits into from
Aug 30, 2022
Merged

Conversation

brimoor
Copy link
Contributor

@brimoor brimoor commented Aug 26, 2022

For some reason, add_samples() and add_collection() had logic in-place to merge annotation/brain/evaluation runs into the destination dataset, but that doesn't make sense as runs are only valid for the particular view on which they were applied, which will not be the same (in general) when merging datasets.

There was already logic in-place to prevent merges when the destination dataset was non-empty, but there wasn't any logic to prevent runs from being merged when the source collection was a view, not a full dataset, which was definitely a bug. So the only valid use case is:

new_dataset = fo.Dataset()
new_dataset.add_collection(dataset)

but that is better expressed as:

new_dataset = dataset.clone()

So, I just removed this code :)

@brimoor brimoor added the cleaning Code cleaning label Aug 26, 2022
@brimoor brimoor requested a review from a team August 26, 2022 17:29
@brimoor brimoor self-assigned this Aug 26, 2022
curr_fields = self.get_field_schema()
add_field_fcn = self.add_sample_field
self._apply_schema(curr_fields, new_fields, add_field_fcn)
for field_name, field_str in new_fields.items():
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also removed the unused curr_fields argument in these two functions

Copy link
Contributor

@benjaminpkane benjaminpkane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@brimoor brimoor merged commit 6b966a6 into develop Aug 30, 2022
@brimoor brimoor deleted the bugfix/merge-runs branch August 30, 2022 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleaning Code cleaning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants