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

Allow lists wherever possible in builtin operators #5241

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fiftyone/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1936,8 +1936,8 @@ def _populate_summary_field(self, field_name, summary_info):
else:
_id = "_id"

if list_fields:
pipeline.append({"$unwind": "$" + list_fields[0]})
for list_field in list_fields:
pipeline.append({"$unwind": "$" + list_field})
brimoor marked this conversation as resolved.
Show resolved Hide resolved

if field_type == "categorical":
if include_counts:
Expand Down
14 changes: 14 additions & 0 deletions fiftyone/core/odm/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,8 @@ def _clear_fields(cls, sample_collection, paths):
"""
is_dataset = isinstance(sample_collection, fod.Dataset)

paths = _remove_nested_paths(paths)

simple_paths = []
coll_paths = []

Expand Down Expand Up @@ -716,6 +718,8 @@ def _delete_fields(cls, paths, error_level=0):
media_type = dataset.media_type
is_frame_field = cls._is_frames_doc

paths = _remove_nested_paths(paths)

del_paths = []
del_schema_paths = []

Expand Down Expand Up @@ -819,6 +823,8 @@ def _remove_dynamic_fields(cls, paths, error_level=0):
dataset = cls._dataset
dataset_doc = dataset._doc

paths = _remove_nested_paths(paths)

del_paths = []

for path in paths:
Expand Down Expand Up @@ -1863,6 +1869,14 @@ def _split_path(path):
return chunks[0], chunks[1]


def _remove_nested_paths(paths):
return [
path
for path in paths
if not any(path.startswith(p + ".") for p in paths)
]


def _add_field_doc(field_docs, root_doc, field_or_doc):
if isinstance(field_or_doc, fof.Field):
new_field_doc = SampleFieldDocument.from_field(field_or_doc)
Expand Down
Loading
Loading