Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Refactor
Signed-off-by: Felix Wang <wangfelix98@gmail.com>
  • Loading branch information
felixwang9817 committed May 4, 2022
commit 8593910e8ab592d6eb9e483f19cb1885fbc887b9
7 changes: 5 additions & 2 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ def _list_feature_views(
):
if hide_dummy_entity and fv.entities[0] == DUMMY_ENTITY_NAME:
fv.entities = []
fv.entity_columns = []
feature_views.append(fv)
return feature_views

Expand Down Expand Up @@ -1555,8 +1556,10 @@ def _get_entity_maps(
entity.join_key, entity.join_key
)
entity_name_to_join_key_map[entity_name] = join_key
for entity_field in feature_view.entity_columns:
entity_type_map[entity_field.name] = entity_field.dtype.to_value_type()
for entity_column in feature_view.entity_columns:
entity_type_map[
entity_column.name
] = entity_column.dtype.to_value_type()

return (
entity_name_to_join_key_map,
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def update_feature_views_with_inferred_features_and_entities(
not in [entity_column.name for entity_column in fv.entity_columns]
and entity.value_type != ValueType.UNKNOWN
):
entity_column.append(
fv.entity_columns.append(
Field(
name=entity.join_key, dtype=from_value_type(entity.value_type),
)
Expand Down
5 changes: 2 additions & 3 deletions sdk/python/feast/infra/offline_stores/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,9 @@ def evaluate_historical_retrieval():
# Build a list of entity columns to join on (from the right table)
join_keys = []

for entity_name in feature_view.entities:
entity = registry.get_entity(entity_name, project)
for entity_column in feature_view.entity_columns:
join_key = feature_view.projection.join_key_map.get(
entity.join_key, entity.join_key
entity_column.name, entity_column.name
)
join_keys.append(join_key)

Expand Down
15 changes: 7 additions & 8 deletions sdk/python/feast/infra/offline_stores/offline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ def get_expected_join_keys(
) -> Set[str]:
join_keys = set()
for feature_view in feature_views:
for entity_name in feature_view.entities:
entity = registry.get_entity(entity_name, project)
for entity_column in feature_view.entity_columns:
join_key = feature_view.projection.join_key_map.get(
entity.join_key, entity.join_key
entity_column.name, entity_column.name
)
join_keys.add(join_key)
return join_keys
Expand Down Expand Up @@ -113,14 +112,14 @@ def get_feature_view_query_context(

query_context = []
for feature_view, features in feature_views_to_feature_map.items():
join_keys, entity_selections = [], []
for entity_name in feature_view.entities:
entity = registry.get_entity(entity_name, project)
join_keys: List[str] = []
entity_selections: List[str] = []
for entity_column in feature_view.entity_columns:
join_key = feature_view.projection.join_key_map.get(
entity.join_key, entity.join_key
entity_column.name, entity_column.name
)
join_keys.append(join_key)
entity_selections.append(f"{entity.join_key} AS {join_key}")
entity_selections.append(f"{entity_column.name} AS {join_key}")

if isinstance(feature_view.ttl, timedelta):
ttl_seconds = int(feature_view.ttl.total_seconds())
Expand Down