Skip to content

feat(dynamodb): Use ProjectionExpression when requested_features is set#6366

Open
Jwrede wants to merge 3 commits intofeast-dev:masterfrom
Jwrede:fix/dynamodb-projection-expression
Open

feat(dynamodb): Use ProjectionExpression when requested_features is set#6366
Jwrede wants to merge 3 commits intofeast-dev:masterfrom
Jwrede:fix/dynamodb-projection-expression

Conversation

@Jwrede
Copy link
Copy Markdown
Contributor

@Jwrede Jwrede commented May 3, 2026

Summary

  • online_read and online_read_async accept requested_features but ignored it -- DynamoDB always fetched all features from the values map
  • Added ProjectionExpression to BatchGetItem requests when requested_features is provided, so DynamoDB only returns entity_id, event_ts, and the requested feature attributes within values
  • Uses ExpressionAttributeNames to avoid conflicts with DynamoDB reserved words
  • Works for both single-batch (resource API) and multi-batch (client API / async) code paths

Fixes

Fixes #6058

Test plan

  • test_build_projection_expression -- verifies correct DynamoDB expression generation
  • test_build_projection_expression_none -- verifies None/empty returns None
  • test_dynamodb_online_store_online_read_with_requested_features -- verifies only requested features are returned (moto)
  • test_dynamodb_online_store_online_read_without_requested_features -- verifies all features returned when not specified (moto)
  • test_dynamodb_online_store_online_read_requested_features_parallel -- verifies filtering across parallel batches (moto)
  • All 39 existing + new DynamoDB unit tests pass

The requested_features parameter was accepted by online_read and
online_read_async but never used -- DynamoDB always fetched all
features stored in the values map regardless. Add a
ProjectionExpression to BatchGetItem requests when requested_features
is provided, reducing data transfer, latency, and read costs.

Fixes feast-dev#6058

Signed-off-by: Jonathan Wrede <wrede.jonathan00@gmail.com>
@Jwrede Jwrede requested a review from a team as a code owner May 3, 2026 17:27
Jwrede and others added 2 commits May 3, 2026 17:33
The return dict contains both str and Dict[str, str] values, so the
return type must be Dict[str, Any] not Dict[str, str].

Signed-off-by: Jonathan Wrede <wrede.jonathan00@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DynamoDB online_read ignores requested_features parameter

1 participant