Skip to content

#7102 Fix enhanced client list projection placeholders#7112

Open
arnabnandy7 wants to merge 1 commit into
aws:masterfrom
arnabnandy7:bugfix/enhanced-client-attributes
Open

#7102 Fix enhanced client list projection placeholders#7112
arnabnandy7 wants to merge 1 commit into
aws:masterfrom
arnabnandy7:bugfix/enhanced-client-attributes

Conversation

@arnabnandy7

Copy link
Copy Markdown

Motivation and Context

Fixes #7102.

addAttributeToProject("tags[0]") in the DynamoDB Enhanced Client generated an invalid ExpressionAttributeNames key containing brackets, such as #AMZN_MAPPED_tags[0]. DynamoDB rejects that key. The placeholder should map only the attribute name, while the list dereference remains in the projection expression.

Modifications

  • Updated ProjectionExpression to strip trailing list dereferences when generating expression attribute name placeholders.
  • Preserved list dereference suffixes in the final projection expression, so tags[0] now produces:
    • ExpressionAttributeNames: { "#AMZN_MAPPED_tags": "tags" }
    • ProjectionExpression: "#AMZN_MAPPED_tags[0]"
  • Added unit coverage for projection expressions with list dereferences, including nested paths.
  • Added scan request generation coverage for ScanEnhancedRequest.builder().addAttributeToProject("tags[0]").
  • Added a changelog entry via scripts/new-change.

Testing

  • Ran git diff --check successfully.
  • Attempted targeted Maven test runs, but local verification was blocked by unrelated repository/build state:
    • module-only test run could not resolve local snapshot artifacts: dynamodb and service-test-utils
    • reactor -am run hit unrelated generated-region clobber/stale target output and Apache client target-class issues before reaching the enhanced client tests

Screenshots (if appropriate)

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
@arnabnandy7 arnabnandy7 requested a review from a team as a code owner July 8, 2026 07:46
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.

Bug in addAttributeToProject in enhanced client for list attributes

1 participant