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

Enforce case-insensitively unique feature view names #1835

Merged
merged 2 commits into from
Sep 7, 2021
Merged
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
11 changes: 6 additions & 5 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,12 +982,13 @@ def _print_materialization_log(


def _validate_feature_views(feature_views: List[FeatureView]):
""" Verify feature views have unique names"""
name_to_fv_dict = {}
""" Verify feature views have case-insensitively unique names"""
fv_names = set()
for fv in feature_views:
if fv.name in name_to_fv_dict:
case_insensitive_fv_name = fv.name.lower()
if case_insensitive_fv_name in fv_names:
raise ValueError(
f"More than one feature view with name {fv.name} found. Please ensure that all feature view names are unique. It may be necessary to ignore certain files in your feature repository by using a .feastignore file."
f"More than one feature view with name {case_insensitive_fv_name} found. Please ensure that all feature view names are case-insensitively unique. It may be necessary to ignore certain files in your feature repository by using a .feastignore file."
)
else:
name_to_fv_dict[fv.name] = fv
fv_names.add(case_insensitive_fv_name)
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def test_cli_apply_duplicated_featureview_names() -> None:

assert (
rc != 0
and b"Please ensure that all feature view names are unique" in output
and b"Please ensure that all feature view names are case-insensitively unique"
in output
)


Expand Down Expand Up @@ -76,5 +77,6 @@ def test_cli_apply_duplicated_featureview_names_multiple_py_files() -> None:

assert (
rc != 0
and b"Please ensure that all feature view names are unique" in output
and b"Please ensure that all feature view names are case-insensitively unique"
in output
)
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ def test_reapply_feature_view_success(test_feature_store, dataframe_source):
test_feature_store.teardown()


def test_apply_duplicated_featureview_names(feature_store_with_local_registry):
""" Test applying feature views with duplicated names"""
def test_apply_conflicting_featureview_names(feature_store_with_local_registry):
""" Test applying feature views with non-case-insensitively unique names"""

driver_stats = FeatureView(
name="driver_hourly_stats",
Expand All @@ -495,7 +495,7 @@ def test_apply_duplicated_featureview_names(feature_store_with_local_registry):
)

customer_stats = FeatureView(
name="driver_hourly_stats",
name="DRIVER_HOURLY_STATS",
entities=["id"],
ttl=timedelta(seconds=10),
online=False,
Expand All @@ -509,7 +509,8 @@ def test_apply_duplicated_featureview_names(feature_store_with_local_registry):
error = e
assert (
isinstance(error, ValueError)
and "Please ensure that all feature view names are unique" in error.args[0]
and "Please ensure that all feature view names are case-insensitively unique"
in error.args[0]
)

feature_store_with_local_registry.teardown()