Skip to content

PR/DynamoDB operations and parsers#1521

Open
aschenzle wants to merge 4 commits intomasterfrom
pr/dynamodb-operations-and-parsers
Open

PR/DynamoDB operations and parsers#1521
aschenzle wants to merge 4 commits intomasterfrom
pr/dynamodb-operations-and-parsers

Conversation

@aschenzle
Copy link
Copy Markdown
Collaborator

Introduces DynamoDB operations and parsers. The design differ a little bit from Mongo and other DBs as DynamoDB has complex expression that need to be parsed in order of precedence. There are top level parsers instead of simple selectors and the logic is split per Dynamo API call and some helper classes. To avoid writing a full blown parser I'm using Antlr as a runtime dependency in controller, I shaded the dependency but please let me know if this could bring any problems or if I'm missing something.

Some random comments: 1) Netty dependency is no longer explicitly needed in controller as now AWSSDK is bringing it. 2) There's a fix for hibernate-validator dependency which is unrelated but eliminates some warnings. 3) Added SimpleLogger to controller tests, eliminates a warning when running tests and actually logs (for example I could see the whole Docker log which wasn't visible before), this will probably increase the warning count when running tests, this is just surfacing them.

@aschenzle aschenzle requested a review from jgaleotti April 24, 2026 06:13
* @param lowerBound lower bound value
* @param upperBound upper bound value
*/
public BetweenOperation(String fieldName, Object lowerBound, Object upperBound) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why lower and upper bounds are objects?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because they can be strings (or binary! just realized this one, don't think I tested it). From DynamoDB doc: "BETWEEN : Greater than or equal to the first value, and less than or equal to the second value.

AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {"S":"6"} does not compare to {"N":"6"}. Also, {"N":"6"} does not compare to {"NS":["6", "2", "1"]}"

/**
* Shared reflection helpers used by DynamoDB parser utilities.
*/
public final class DynamoDbReflectionHelper {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this class for? I am not understanding why reflection is needed for parsing DynamoDB queries

return Collections.emptyMap();
}

Map<String, QueryOperation> parsed = parser.parseRequest(request);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request is a dynamoDB object?

@jgaleotti
Copy link
Copy Markdown
Collaborator

Why don't you dump the dynamoDB query into a string and then parse it back from it?

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