diff --git a/js_modules/dagster-ui/packages/ui-core/src/ui/BaseFilters/useStaticSetFilter.tsx b/js_modules/dagster-ui/packages/ui-core/src/ui/BaseFilters/useStaticSetFilter.tsx index 12d5a47566639..3e490ec08e86f 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/ui/BaseFilters/useStaticSetFilter.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/ui/BaseFilters/useStaticSetFilter.tsx @@ -260,7 +260,7 @@ export function SetFilterActiveState({ name: string; filterBarTagLabel?: JSX.Element; icon: IconName; - state: Set | any[]; + state: Set | any[] | any; getStringValue: (value: any) => string; getTooltipText?: ((value: any) => string) | undefined; onRemove?: () => void; diff --git a/python_modules/dagster/dagster/_core/definitions/asset_selection.py b/python_modules/dagster/dagster/_core/definitions/asset_selection.py index 0ff10f87e20e5..20a03cc6a2e4c 100644 --- a/python_modules/dagster/dagster/_core/definitions/asset_selection.py +++ b/python_modules/dagster/dagster/_core/definitions/asset_selection.py @@ -8,6 +8,9 @@ import dagster._check as check from dagster._annotations import deprecated, experimental, experimental_param, public +from dagster._core.definitions.antlr_asset_selection.antlr_asset_selection import ( + AntlrAssetSelectionParser, +) from dagster._core.definitions.asset_check_spec import AssetCheckKey from dagster._core.definitions.asset_graph import AssetGraph from dagster._core.definitions.asset_key import ( @@ -495,27 +498,30 @@ def resolve_checks_inner( @classmethod def from_string(cls, string: str) -> "AssetSelection": - if string == "*": - return cls.all() - - parts = parse_clause(string) - if parts is not None: - key_selection = cls.assets(parts.item_name) - if parts.up_depth and parts.down_depth: - selection = key_selection.upstream(parts.up_depth) | key_selection.downstream( - parts.down_depth - ) - elif parts.up_depth: - selection = key_selection.upstream(parts.up_depth) - elif parts.down_depth: - selection = key_selection.downstream(parts.down_depth) - else: - selection = key_selection - return selection - - elif string.startswith("tag:"): - tag_str = string[len("tag:") :] - return cls.tag_string(tag_str) + try: + return AntlrAssetSelectionParser(string).asset_selection + except: + if string == "*": + return cls.all() + + parts = parse_clause(string) + if parts is not None: + key_selection = cls.assets(parts.item_name) + if parts.up_depth and parts.down_depth: + selection = key_selection.upstream(parts.up_depth) | key_selection.downstream( + parts.down_depth + ) + elif parts.up_depth: + selection = key_selection.upstream(parts.up_depth) + elif parts.down_depth: + selection = key_selection.downstream(parts.down_depth) + else: + selection = key_selection + return selection + + elif string.startswith("tag:"): + tag_str = string[len("tag:") :] + return cls.tag_string(tag_str) check.failed(f"Invalid selection string: {string}")