mboudreau / Alternator

A mock DynamoDB that runs locally for testing purposes - DEPRECATED, PLEASE USE DYNAMODB LOCAL: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html
Apache License 2.0
78 stars 39 forks source link

Improvements to scan requests #71

Closed vdenisov closed 11 years ago

vdenisov commented 11 years ago

Hello,

When working with Alternator, I'd ran into three issues specific to my code:

  1. For scan requests with multiple conditions (such as two EQ's on different attributes), Alternator would return multiple copies of the same item (one for each matching condition).
  2. When updating an item with ADD on an integer-valued number attribute, Alternator would convert it to double (i.e., "1" + "2" = "3.0"); subsequent mappings of this to an int field by DynamoDBMapper would fail.
  3. Since comparisons were (mostly) performed on strings, I ran into issues with number attributes - "120" is less than "50" when compared this way :-(.

Fixing 1 and 2 was easy (see 9845080 and a1a0957). Fixing 3 in a non-ugly way required a significant rework of the scan() method's code. As a side-effect, it's now more spec-compliant (i.e., it won't add number attributes for BEGINS_WITH condition), but the changes are much more severe than for the first two cases.

Hope you would find this contribution helpful.

Regards, Victor Denisov.

mboudreau commented 11 years ago

Wow, that's awesome. Thanks.

I'll release a new version to maven when I get a chance.

Cheers.

mboudreau commented 11 years ago

0.6.3 has been released. Cheers.