diff --git a/merlin/dag/selector.py b/merlin/dag/selector.py index 27d7283e2..13a362ac3 100644 --- a/merlin/dag/selector.py +++ b/merlin/dag/selector.py @@ -45,11 +45,11 @@ def __init__( subgroups: List["ColumnSelector"] = None, tags: List[Union[Tags, str]] = None, ): + self._all = False self._names = names if names is not None else [] self._tags = tags if tags is not None else [] self.subgroups = subgroups if subgroups is not None else [] - self.all = isinstance(names, str) and names == "*" if self.all: self._names = [] self._tags = [] @@ -77,6 +77,11 @@ def __init__( self._names = plain_names self._nested_check() + @property + def all(self): + self._all = self._all or (isinstance(self._names, str) and self._names == "*") + return self._all + @property def tags(self): return list(dict.fromkeys(self._tags).keys()) diff --git a/tests/unit/dag/test_column_selector.py b/tests/unit/dag/test_column_selector.py index 3c87b846a..bd2be7586 100644 --- a/tests/unit/dag/test_column_selector.py +++ b/tests/unit/dag/test_column_selector.py @@ -270,6 +270,12 @@ def test_applying_inverse_selector_to_schema_selects_relevant_columns(): assert result == schema +def test_wildcard_selector_bool(): + selector = ColumnSelector("*") + + assert selector.all is True + + def test_wildcard_selection(): selector = ColumnSelector("*")