Conversation
| * @param lowerBound lower bound value | ||
| * @param upperBound upper bound value | ||
| */ | ||
| public BetweenOperation(String fieldName, Object lowerBound, Object upperBound) { |
There was a problem hiding this comment.
why lower and upper bounds are objects?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
The request is a dynamoDB object?
|
Why don't you dump the dynamoDB query into a string and then parse it back from it? |
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.