Skip to content

Conversation

@iulianbudau
Copy link
Contributor

Support for defining GSIs with up to 4 partition and 4 sort key attributes, plus the ability to query those GSIs with structured conditions via the Enhanced Client.
Key constraints for composite key queries:

  1. Full partition key must be specified
  2. No skipping of preceding sort key attributes
  3. Range conditions allowed only on rightmost sort key attribute

Motivation and Context

Context, feature description and implementation details available in Twin Cities solution proposal.

Modifications

  • Key structure changed to support list of partition keys and sort keys, deprecated old methods but maintaining backward compatibility.
  • Introduced int order parameter in DynamoDbSecondaryPartitionKey and DynamoDbSecondarySortKey interfaces to ensure consistent order of the composite keys definition at HL client level.
  • Refactored StaticTableMetadata to compute the list of indices during schema creation and enhanced BeanTableSchema, ImmutableTableSchema and StaticTableSchema to validate them. Also added support for defining GSI composite keys on flattened objects.
  • Refactored CreateTableOperation to compute the list of GSI indexes with composite keys support.
  • Refactored QueryConditional implementations to support twin cities rules.

Testing

New unit tests added for the GSI composite key extension.
New integration tests added to cover all query conditional operators applied on GSIs with 1 to 4 composite keys combination.

Test Coverage Checklist

Scenario Done Comments 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() [ ]
d. StaticTableSchema.builder(Customer.class) [x]
2. Nesting of Different TableSchema Types
a. @DynamoDbBean with nested @DynamoDbBean as NonNull [ ]
b. @DynamoDbBean with nested @DynamoDbImmutable as NonNull [ ]
c. @DynamoDbImmutable with nested @DynamoDbBean as NonNull [ ]
d. @DynamoDbBean with nested @DynamoDbBean as Null [ ]
e. @DynamoDbBean with nested @DynamoDbImmutable as Null [ ]
f. @DynamoDbImmutable with nested @DynamoDbBean as Null [ ]
3. CRUD Operations
a. scan() [ ]
b. query() [x]
c. updateItem() [ ]
d. putItem() [ ]
e. getItem() [ ]
f. deleteItem() [ ]
g. batchGetItem() [ ]
h. batchWriteItem() [ ]
i. transactGetItems() [ ]
j. transactWriteItems() [ ]
4. Data Types and Null Handling
a. top-level null attributes [ ]
b. collections with null elements [ ]
c. maps with null values [ ]
d. conversion between null Java values and AttributeValue [ ]
e. full serialization/deserialization cycle with null values [ ]
5. AsyncTable and SyncTable
a. DynamoDbAsyncTable Testing [ ]
b. DynamoDbTable Testing [x]
6. New/Modification in Extensions
a. Tables with Scenario in ScenarioSl No.1 (All table schemas are Must) [ ]
b. Test with Default Values in Annotations [ ]
c. Combination of Annotation and Builder passes extension [ ]
7. New/Modification in Converters
a. Tables with Scenario in ScenarioSl No.1 (All table schemas are Must) [ ]
b. Test with Default Values in Annotations [ ]
c. Test All Scenarios from 1 to 5 [ ]

Screenshots (if appropriate)

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

@iulianbudau iulianbudau requested a review from a team as a code owner November 20, 2025 10: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.

2 participants