Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support update expressions in single request update#6471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
anasatirbasa wants to merge2 commits intoaws:master
base:master
Choose a base branch
Loading
fromanasatirbasa:feature/support-update-expressions-in-single-request-update

Conversation

@anasatirbasa
Copy link
Contributor

@anasatirbasaanasatirbasa commentedOct 13, 2025
edited
Loading

Motivation and Context

This enhancement addresses the need for more flexible and powerful update operations in the DynamoDB Enhanced Client. Previously, users could only update items using POJO attributes or extension-generated expressions, but had no way to provide explicit UpdateExpressions directly in their requests. This limitation prevented users from:

  • Performing complex atomic operations (e.g., incrementing counters, appending to lists)
  • Using advanced DynamoDB update features like conditional updates with custom expressions
  • Combining POJO-based updates with custom UpdateExpressions in a single operation

This feature implements support for explicit UpdateExpressions inUpdateItemEnhancedRequest andTransactUpdateItemEnhancedRequest, giving users access to all DynamoDB update features without breaking existing code.

Modifications

Core Changes

  1. Enhanced Request Models

    • AddedupdateExpression() method toUpdateItemEnhancedRequest andTransactUpdateItemEnhancedRequest
    • Maintained backward compatibility - existing code continues to work unchanged
  2. Expression Resolution System

    • CreatedUpdateExpressionResolver class to merge expressions from three sources with priority-based conflict resolution:
      • POJO attributes (lowest priority) - generates SET/REMOVE actions
      • Extension expressions (medium priority) - from client extensions
      • Request expressions (highest priority) - explicit user-provided expressions
    • Implemented smart filtering to prevent DynamoDB conflicts by excluding attributes referenced in extension/request expressions from automatic REMOVE actions
  3. Conflict Prevention

    • Attributes referenced in extension or request expressions are automatically excluded from REMOVE actions generated by null POJO attributes
    • This prevents "Two document paths overlap" errors from DynamoDB when the same attribute is updated by multiple sources
  4. Integration Points

    • UpdatedUpdateItemOperation.generateUpdateExpressionIfExist() to use the new resolver
    • EnhancedUpdateExpressionConverter with attribute name extraction capabilities
    • Added comprehensive test coverage inUpdateExpressionTest

Testing

Test Coverage

  1. Basic Functionality Tests

    • UpdateExpression provided in request works correctly
    • Backward compatibility with POJO-only updates
    • Extension-only updates continue to work
  2. Conflict Resolution Tests

    • POJO vs Request expression conflicts (server-side detection)
    • Extension vs Request expression conflicts (server-side detection)
    • Attribute filtering prevents REMOVE action conflicts
  3. Integration Tests

    • Scan operations after UpdateExpression usage
    • Delete operations after UpdateExpression usage
    • Batch operations (batchGetItem, batchWriteItem)
    • Transactional operations (transactGetItems, transactWriteItems)
    • Static table schema compatibility
  4. Edge Cases

    • Empty expressions
    • Null handling with ignoreNulls flag
    • Multiple chained extensions

Test Results

  • All existing tests pass (backward compatibility verified)
  • New functionality tests pass across all scenarios
  • Performance impact minimal due to efficient expression merging

Test Coverage Checklist

ScenarioDoneComments if Not Done
1. Different TableSchema Creation Methods
a. TableSchema.fromBean(Customer.class)[x]
b. TableSchema.fromImmutableClass(Customer.class) for immutable classes[x]
c. TableSchema.documentSchemaBuilder().build()[ ]Not applicable for UpdateExpression feature
d. StaticTableSchema.builder(Customer.class)[x]
2. Nesting of Different TableSchema Types
a. @DynamoDbBean with annotated auto-generated key[x]
b. @DynamoDbImmutable with annotated auto-generated key[x]
c. Auto-generated key combined with partition/sort key[x]
3. CRUD Operations
a. scan()[x]
b. query()[ ]Not directly tested with UpdateExpression
c. updateItem() preserves existing value or generates when absent[x]
d. putItem() with no key set (auto-generation occurs)[x]
e. putItem() with key set manually[x]
f. getItem() retrieves auto-generated key[x]
g. deleteItem()[x]
h. batchGetItem()[x]
i. batchWriteItem()[x]
j. transactGetItems()[x]
k. transactWriteItems()[x]
4. Data Types and Null Handling
a. Annotated attribute is null → key auto-generated[x]
b. Annotated attribute non-null → value preserved[x]
c. Validation rejects non-String annotated attribute[x]
5. AsyncTable and SyncTable
a. DynamoDbAsyncTable Testing[ ]Focus was on sync operations
b. DynamoDbTable Testing[x]
6. New/Modification in Extensions
a. Works with other extensions like VersionedRecordExtension[x]
b. Test with Default Values in Annotations[ ]Not applicable for UpdateExpression
c. Combination of Annotation and Builder passes extension[ ]Not applicable for UpdateExpression
7. New/Modification in Converters
a. Tables with Scenario in Scenario No.1 (All table schemas are Must)[ ]Not applicable for UpdateExpression
b. Test with Default Values in Annotations[ ]Not applicable for UpdateExpression
c. Test All Scenarios from 1 to 5[ ]Not applicable for UpdateExpression

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read theCONTRIBUTING document
  • Local run ofmvn 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 thescripts/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 updatedLaunchChangelog

License

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

@anasatirbasaanasatirbasa changed the titleFeature/support update expressions in single request updateSupport update expressions in single request updateOct 20, 2025
@anasatirbasaanasatirbasaforce-pushed thefeature/support-update-expressions-in-single-request-update branch from4b664f1 to22a0ffaCompareOctober 20, 2025 13:30
@anasatirbasaanasatirbasaforce-pushed thefeature/support-update-expressions-in-single-request-update branch frombfa9f26 toa7fe576CompareOctober 22, 2025 06:42
@anasatirbasaanasatirbasa marked this pull request as ready for reviewOctober 27, 2025 15:09
@anasatirbasaanasatirbasa requested a review froma team as acode ownerOctober 27, 2025 15:09
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@iulianbudauiulianbudauiulianbudau approved these changes

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@anasatirbasa@iulianbudau

[8]ページ先頭

©2009-2025 Movatter.jp