mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(dynamodb): read every attribute through an ALL-projection index in PartiQL (#3309)
A PartiQL read qualified with a secondary index trimmed each item to the attributes the index projects, but projectedAttributeNames returns only key attributes for an ALL projection, because "all attributes" cannot be enumerated from a schemaless table. Query, Scan and the selection validator each guard that case with "ALL".equals(projectionType); the PartiQL read path did not. Against an index that stores the whole item, a qualified SELECT * therefore dropped every non-key attribute, and naming one explicitly was rejected with "does not project". Both are wrong data rather than an error, and both disappear on the same statement against the base table. The existing coverage used only INCLUDE and KEYS_ONLY indexes, so neither case surfaced. The integration test adds an ALL-projection index and asserts SELECT *, an explicit non-key column, and Query over the same index agreeing; the INCLUDE and KEYS_ONLY expectations are unchanged.
This commit is contained in:
1 parent
2fbe2b7c64
commit
4cb9314a2d
3 files changed
+101
-3
No files matched your search
+5
-3
@@ -56,7 +56,7 @@ class DynamoDbPartiQLHandler {
|
||||
// projects; the message preserves statement order (characterised on
|
||||
// real AWS, eu-west-1, 2026-09-02). An LSI read reaches the co-located
|
||||
// base item, so non-projected columns stay legal there.
|
||||
if (accessPath.isGlobalSecondaryIndex()) {
|
||||
if (accessPath.isGlobalSecondaryIndex() && !"ALL".equals(accessPath.projectionType())) {
|
||||
Set<String> projected = accessPath.projectedAttributeNames(table);
|
||||
List<String> unprojected = stmt.columns().stream()
|
||||
.filter(c -> !"*".equals(c))
|
||||
@@ -151,8 +151,10 @@ class DynamoDbPartiQLHandler {
|
||||
.toList();
|
||||
}
|
||||
|
||||
// SELECT * over an index reads the projection, not the whole item.
|
||||
if (stmt.columns().isEmpty() && accessPath.isIndex()) {
|
||||
// SELECT * over an index reads the projection, not the whole item. An
|
||||
// ALL projection stores every base attribute, so nothing is trimmed.
|
||||
if (stmt.columns().isEmpty() && accessPath.isIndex()
|
||||
&& !"ALL".equals(accessPath.projectionType())) {
|
||||
Set<String> projected = accessPath.projectedAttributeNames(table);
|
||||
items = items.stream()
|
||||
.map(item -> (JsonNode) ProjectionEvaluator.trimToAttributes((ObjectNode) item, projected))
|
||||
|
||||
Reference in new issue
Block a user