-
Notifications
You must be signed in to change notification settings - Fork 37
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct comparator of item sorter in Dynamo DB adapter #327
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Good catch! Thank you!
@thongdk8 Sorry, I forgot one thing. Can you please add a unit test for this? We basically need a unit test to make sure the bug is really fixed in this kind of case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Thank you.
Left 1 comment. PTAL:bow:
@@ -264,10 +266,27 @@ public void sort_ItemsGivenWithDescOrderingText_ShouldSortProperly() { | |||
@Test | |||
public void sort_ItemsGivenWithDescOrderingBlob_ShouldSortProperly() { | |||
// Arrange | |||
Random random = new Random(777); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just wondering if there is any benefit of using Random with a fixed seed here.
I feel it's better to use fixed hard-coded byte arrays so that we (people) can see what is the expected result.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes more sense if we test many cases using loop and random but the test was only comparing two byte-arrays, that's why I asked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. So should we use random and for loop here or keep it like the new commit I made?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the current code is fine and consistent with other tests.
If you feel it's not tested well, we can add more tests with loop and random. (please add instead of update in such a case)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thongdk8 I will merge this. If you want add more tests with loop and random, please create a new PR for that. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
Current implementation using byte buffer comparator so it makes the result when scanning with clustering key of blob values not correctly. This PR made for correct the comparator. Please take a look. Thank you.