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

Fix get_online_features return schema #1455

Merged
merged 1 commit into from
Apr 12, 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
2 changes: 1 addition & 1 deletion sdk/python/feast/online_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def to_dict(self) -> Dict[str, Any]:
"""
Converts GetOnlineFeaturesResponse features into a dictionary form.
"""
fields = [k for row in self.field_values for k, _ in row.fields.items()]
fields = [k for row in self.field_values for k, _ in row.statuses.items()]
features_dict: Dict[str, List[Any]] = {k: list() for k in fields}

for row in self.field_values:
Expand Down
8 changes: 8 additions & 0 deletions sdk/python/tests/test_online_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ def test_online() -> None:
assert result["customer_profile__name"] == ["John", "John"]
assert result["customer_driver_combined__trips"] == [7, 7]

# Ensure features are still in result when keys not found
result = store.get_online_features(
feature_refs=["customer_driver_combined:trips"],
entity_rows=[{"driver": 0, "customer": 0}],
).to_dict()

assert "customer_driver_combined__trips" in result

# invalid table reference
with pytest.raises(ValueError):
store.get_online_features(
Expand Down