-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Problem
In the Feast Python SDK, get_online_features resolves feature view names through _get_any_feature_view, which checks the registry tables in a fixed order:
- Regular
FeatureView OnDemandFeatureViewStreamFeatureView
This means if a project registers both a regular FeatureView and a StreamFeatureView (or OnDemandFeatureView) sharing the same name, get_online_features will always return the regular feature view — even if the stream view is the one producing the freshest data.
Relevant code
SqlRegistry._get_any_feature_view (sql.py#L374-L409):
def _get_any_feature_view(self, name: str, project: str) -> BaseFeatureView:
fv = self._get_object(table=feature_views, ...)
if not fv:
fv = self._get_object(table=on_demand_feature_views, ...)
if not fv:
fv = self._get_object(table=stream_feature_views, ...)
return fvproto_registry_utils.get_any_feature_view follows the same fixed-order pattern for the cached registry path.
Same pattern in FeatureStore.apply
During apply, the different feature view types are separated into independent lists (views_to_update, sfvs_to_update, odfvs_to_update) and applied independently — there is no cross-type uniqueness check on names.
Expected Behavior
feast apply should fail with a clear error if a feature view name collides across different feature view types (e.g., a FeatureView and a StreamFeatureView sharing the same name). This would prevent silent, hard-to-debug issues at serving time.
Proposed Solution
Add a validation step in FeatureStore.apply() (or _validate_feature_views) that collects all feature view names across FeatureView, OnDemandFeatureView, and StreamFeatureView, and raises a ValueError if any duplicates are found.
Implementation guidance
-
Where to add the check: In
FeatureStore.apply()(feature_store.py#L770), after the objects are separated intoviews_to_update,sfvs_to_update, andodfvs_to_update(around line 849), add a cross-type name uniqueness validation. -
What the check should do:
- Collect all names from
views_to_update,sfvs_to_update, andodfvs_to_update - Detect any duplicate names across these lists
- Raise a clear
ValueErrorlisting the duplicated name(s) and which types collide
- Collect all names from
-
Alternatively or additionally, the
_validate_feature_viewsmethod (feature_store.py#L560-L579) could be extended to include this cross-type check. -
Tests: Add unit tests that verify
applyraises an error when feature views of different types share the same name.
References
- Discussed in Feast Slack #feast-beginners: thread