perf(dynamodb): read Query and Scan expressions once per request (#8454)

Query parsed its key condition, and Query and Scan their filter, for
every item, and every returned item rebuilt the projection. Each
expression is now parsed when the first item reaches it and evaluated
against the rest, and Query, Scan and BatchGetItem build one projection
per request through ProjectionEvaluator.projector. A scan that evaluates
no item still reads no filter, as before, and the list-index pattern is
compiled once.

Closes #8462
This commit is contained in:
Wei-Lun Li authored and GitHub committed 2026-11-15 10:34:06 -04:00
1 parent d7c42e2065
commit 00fdb95ab5
5 files changed
+61 -13

No files matched your search

@@ -1162,6 +1162,17 @@ class DynamoDbServiceTest {
assertEquals(2, result.items().size());
}
@Test
void scanOfEmptyTableDoesNotReadFilterExpression() {
// Callers that skip the handler's validation (the Step Functions scan integration)
// only see a malformed FilterExpression once an item is evaluated.
String region = "eu-west-1";
createUsersTable(region);
DynamoDbService.ScanResult result = service.scan("Users", "nickname = = :n", null, null, null, null, null, region);
assertEquals(0, result.items().size());
}
@Test
void scanWithLimit() {
String region = "eu-west-1";