-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Fix IS DISTINCT FROM for decimals with precision > 18 #13668
Fix IS DISTINCT FROM for decimals with precision > 18 #13668
Conversation
@ptkool , thanks for catching the bug and adding a fix. Couple of observations
|
@ajaygeorge The issue is actually with decimal values with precision > 18, not 19.
Note that this issue only occurs when reading decimal values from a table and Presto creates instances of |
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.
you might need to update Release Notes in the PR since this is a user impacting change.
Also please update the issue description in #13667 to reflect that the issue is for precision > 18
Adding @cemcayiroglu and @mbasmanova who can help review and merge this.
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.
@ptkool Michael, looks good. Thanks for fixing this issue. Please squash the commits and make commit message clearer. Perhaps, Fix IS DISTINCT FROM for long decimals
.
@Test | ||
public void testIsDistinctFrom() | ||
{ | ||
long[] arr1 = {112L, 0L}; // DECIMAL '1.12' |
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.
- don't use a1, a2, etc. variables names; here, I'd just inline arr1 and arr2
- static import distinctBlockPositionLongLong
@Test
public void testIsDistinctFrom()
{
Block left = new Int128ArrayBlock(1, Optional.empty(), new long[] {112L, 0L});
Block right = new Int128ArrayBlock(1, Optional.empty(), new long[] {185L, 0L});
assertFalse(distinctBlockPositionLongLong(left, 0, left, 0));
assertTrue(distinctBlockPositionLongLong(left, 0, right, 0));
}
45a4ca9
to
a7fb354
Compare
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.
@ptkool Looks good. Please remove the following from commit message
Add new test
Clean up based on feedback
a7fb354
to
6f212b3
Compare
@ptkool Michael, I noticed that you updated the PR, but commit message didn't change. You need to use |
@mbasmanova Commit message has been updated. Can you review this again? |
@ptkool Hmm... I don't see commit message updated. Here is what I see. |
6f212b3
to
aa170b8
Compare
aa170b8
to
cea8be9
Compare
@mbasmanova Commit message has been fixed. |
@ptkool Thank you for the contribution. |
The current logic in method
distinctBlockPositionLongLong
compares the left value to itself. This PR corrects this by assigning the proper values torightLow
andrightHigh
.Fixes #13667.