NVIDIA-Merlin / core

Core Utilities for NVIDIA Merlin
Apache License 2.0
19 stars 14 forks source link

Enable Compound Tag Selection and Removal to work with atomic tags and strings #317

Closed oliverholworthy closed 1 year ago

oliverholworthy commented 1 year ago

Enable Compound Tag Selection and Removal to work with atomic tags, strings, and compound tags interchangably.

Selection with Compound Tag

Selecting from a schema with ITEM and ID tags is currently not working when passed a compound Tag Tags.ITEM_ID or

Before

(
    Schema([ColumnSchema("item_id", tags=[Tags.ITEM, Tags.ID])])
    .select_by_tag(Tags.ITEM_ID)
)
# => []

After

(
    Schema([ColumnSchema("item_id", tags=[Tags.ITEM, Tags.ID])])
    .select_by_tag(Tags.ITEM_ID)
)
# => [ColumnSchema("item_id", ...)]

Removal with Compound Tag

Before

(
    Schema([ColumnSchema("item_id", tags=[Tags.ITEM, Tags.ID])])
    .remove_by_tag(Tags.ITEM_ID)
)
# => [ColumnSchema("item_id", ...)]

After

(
    Schema([ColumnSchema("item_id", tags=[Tags.ITEM, Tags.ID])])
    .remove_by_tag(Tags.ITEM_ID)
)
# => []
github-actions[bot] commented 1 year ago

Documentation preview

https://nvidia-merlin.github.io/core/review/pr-317