Skip to content

get_online_features on remote stores drops all join keys but the first #6488

@dbbvitor

Description

@dbbvitor

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.

        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:

    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),
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions