Skip to content

DynamoDB online_read ignores requested_features parameter #6058

@abhijeet-dhumal

Description

@abhijeet-dhumal

Expected Behavior

When calling get_online_features() with a subset of features (e.g., ["fv:feature_a", "fv:feature_b"]), the DynamoDB online store should only fetch those specific features using DynamoDB's ProjectionExpression. This reduces data transfer, lowers latency, and decreases read costs.

Current Behavior

The requested_features parameter is passed through the call chain to online_read() and online_read_async() but is completely ignored. DynamoDB's BatchGetItem fetches all features stored in the values map regardless of what features were requested.

# In dynamodb.py line 559-560
async def online_read_async(
    ...
    requested_features: Optional[List[str]] = None,  # Parameter accepted but unused
)

The BatchGetItem call does not include ProjectionExpression:

# Current implementation (line 619-621)
client.batch_get_item(
    RequestItems=entity_id_batch,  # No ProjectionExpression
)

Steps to reproduce

from feast import FeatureStore

fs = FeatureStore(repo_path=".")

# Request only 2 features out of 200 stored
response = fs.get_online_features(
    features=["my_fv:feature_a", "my_fv:feature_b"],  # Only 2 features
    entity_rows=[{"entity_id": "user_1"}]
)

# Expected: DynamoDB fetches only feature_a, feature_b
# Actual: DynamoDB fetches all 200 features, wastes bandwidth

Specifications

  • Version: 0.60.0 and latest master
  • Platform: Any (tested on OpenShift/Kubernetes)
  • Subsystem: feast.infra.online_stores.dynamodb

Possible Solution

Add ProjectionExpression to BatchGetItem requests when requested_features is specified

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions