feast-dev / feast-dev/feast

get_online_features on remote stores drops all join keys but the first

Open
#6,488 3 comments 0 reactions 0 assignees View on GitHub
kind/bug priority/p2
Dominant language
Python
Stars
7.3k
Forks
1.4k
Avg merge
1d 21h
Merged PRs (30d)
15

Description

## Expected Behavior

Feast would use all the entity_keys passed by the user to fetch the proper rows.

## Current Behavior

Feast only uses the first entity_key.

```python
entity_values = []
entity_key = ""
for row in entity_keys:
entity_key = row.join_keys[0]
entity_values.append(
getattr(row.entity_values[0], row.entity_values[0].WhichOneof("val")) # type: ignore[arg-type]
)
```
The error is evident by the use of 0 index on the row.join_keys.

## Steps to reproduce

Fetch a multi-key online feature from a remote online store

### Specifications

- Version: 0.63.0
- Platform: FeatureStore CR / K8s

## Possible Solution

Something like this:
```python
entities = {}
for row in entity_keys:
if len(row.join_keys) != len(row.entity_values):
raise ValueError(
"EntityKeyProto has mismatched join_keys and entity_values lengths."
)

for join_key, entity_value in zip(row.join_keys, row.entity_values):
value_attr = entity_value.WhichOneof("val")
if value_attr is None:
entities[join_key].append(None)
else:
entities[join_key].append(getattr(entity_value, value_attr))

return {
"features": api_requested_features,
"entities": dict(entities),
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.