Skip to content

fix(projection): preserve nested structure through intermediate list indices#33

Open
pdf-amzn wants to merge 1 commit into
ExtendDB:mainfrom
pdf-amzn:fix-projection-list-index
Open

fix(projection): preserve nested structure through intermediate list indices#33
pdf-amzn wants to merge 1 commit into
ExtendDB:mainfrom
pdf-amzn:fix-projection-list-index

Conversation

@pdf-amzn
Copy link
Copy Markdown
Collaborator

@pdf-amzn pdf-amzn commented May 18, 2026

When projecting a path like a.b[0].c, the intermediate list index
handler was returning early with just the leaf value wrapped in a list,
producing {"a": {"b": ["target"]}}. The correct DynamoDB behavior
is to preserve the nested map structure after the list index, producing
{"a": {"b": [{"c": "target"}]}}.

Add build_remaining_structure() helper that recursively builds the
nested attribute/list structure for all path elements after the
intermediate list index before wrapping in the single-element list.

Verified against real DynamoDB: GetItem with ProjectionExpression
'a.b[0].c' returns the map wrapper around 'c'.

…indices

When projecting a path like a.b[0].c, the intermediate list index
handler was returning early with just the leaf value wrapped in a list,
producing {"a": {"b": ["target"]}}. The correct DynamoDB behavior
is to preserve the nested map structure after the list index, producing
{"a": {"b": [{"c": "target"}]}}.

Add build_remaining_structure() helper that recursively builds the
nested attribute/list structure for all path elements after the
intermediate list index before wrapping in the single-element list.

Verified against real DynamoDB: GetItem with ProjectionExpression
'a.b[0].c' returns the map wrapper around 'c'.

Fixes review concern #15.
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.

2 participants