Skip to content

Commit

Permalink
fix: Entityless fv breaks with KeyError: __dummy applying feature_s…
Browse files Browse the repository at this point in the history
…tore.plan() on python (feast-dev#3640)

* fix! KeyError: __dummy on entityless fv

Signed-off-by: williamfoschiera <william.foschiera@buser.com.br>

* fix! join_keys typing.

Signed-off-by: williamfoschiera <william.foschiera@buser.com.br>

---------

Signed-off-by: williamfoschiera <william.foschiera@buser.com.br>
Co-authored-by: williamfoschiera <william.foschiera@buser.com.br>
  • Loading branch information
wfoschiera and williamfoschiera authored Jul 13, 2023
1 parent 1c01035 commit ef4ef32
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions sdk/python/feast/inference.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import List, Set, Union
from typing import List, Optional, Set, Union

from feast.data_source import DataSource, PushSource, RequestSource
from feast.entity import Entity
Expand Down Expand Up @@ -119,7 +119,10 @@ def update_feature_views_with_inferred_features_and_entities(

for fv in fvs:
join_keys = set(
[entity_name_to_join_key_map[entity_name] for entity_name in fv.entities]
[
entity_name_to_join_key_map.get(entity_name)
for entity_name in fv.entities
]
)

# Fields whose names match a join key are considered to be entity columns; all
Expand All @@ -137,7 +140,10 @@ def update_feature_views_with_inferred_features_and_entities(

# Respect the `value_type` attribute of the entity, if it is specified.
for entity_name in fv.entities:
entity = entity_name_to_entity_map[entity_name]
entity = entity_name_to_entity_map.get(entity_name)
# pass when entity does not exist. Entityless feature view case
if entity is None:
continue
if (
entity.join_key
not in [entity_column.name for entity_column in fv.entity_columns]
Expand Down Expand Up @@ -181,7 +187,7 @@ def update_feature_views_with_inferred_features_and_entities(

def _infer_features_and_entities(
fv: FeatureView,
join_keys: Set[str],
join_keys: Set[Optional[str]],
run_inference_for_features,
config,
) -> None:
Expand Down

0 comments on commit ef4ef32

Please sign in to comment.