Skip to content

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

Merged
ntkathole merged 2 commits into
feast-dev:masterfrom
Jwrede:fix/dynamodb-projection-expression
May 14, 2026
Merged

feat(dynamodb): Use ProjectionExpression when requested_features is set#6366
ntkathole merged 2 commits into
feast-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

@Jwrede Jwrede requested a review from a team as a code owner May 3, 2026 17:27
@ntkathole ntkathole force-pushed the fix/dynamodb-projection-expression branch from 595a4bf to a872a88 Compare May 6, 2026 08:31
@Jwrede
Copy link
Copy Markdown
Contributor Author

Jwrede commented May 13, 2026

Friendly ping @franciscojavierarceo -- this has been open ~10 days. Let me know if anything needs adjusting.

Jwrede added 2 commits May 14, 2026 12:13
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>
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>
@ntkathole ntkathole force-pushed the fix/dynamodb-projection-expression branch from e9d7e8a to 2500dd3 Compare May 14, 2026 06:43
@ntkathole ntkathole merged commit 217b4da into feast-dev:master May 14, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DynamoDB online_read ignores requested_features parameter

2 participants