feat(dynamodb): Use ProjectionExpression when requested_features is set#6366
Open
Jwrede wants to merge 3 commits intofeast-dev:masterfrom
Open
feat(dynamodb): Use ProjectionExpression when requested_features is set#6366Jwrede wants to merge 3 commits intofeast-dev:masterfrom
Jwrede wants to merge 3 commits intofeast-dev:masterfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
online_readandonline_read_asyncacceptrequested_featuresbut ignored it -- DynamoDB always fetched all features from thevaluesmapProjectionExpressiontoBatchGetItemrequests whenrequested_featuresis provided, so DynamoDB only returnsentity_id,event_ts, and the requested feature attributes withinvaluesExpressionAttributeNamesto avoid conflicts with DynamoDB reserved wordsFixes
Fixes #6058
Test plan
test_build_projection_expression-- verifies correct DynamoDB expression generationtest_build_projection_expression_none-- verifies None/empty returns Nonetest_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)