Skip to content
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

Fixing bug: IS DISTINCT FROM NULL should work for NULL column values #15128

Merged
merged 1 commit into from
Sep 17, 2020
Merged

Fixing bug: IS DISTINCT FROM NULL should work for NULL column values #15128

merged 1 commit into from
Sep 17, 2020

Conversation

ssaumitra
Copy link
Contributor

@ssaumitra ssaumitra commented Sep 7, 2020

Fixes #15107.

Test plan - Tested using the new test in AbstractTestQueries. Also ran the tests from TestExpressionInterpreter.testIsDistinctFrom

== RELEASE NOTES ==
* Fix incorrect behavior of `expression IS DISTINCT FROM NULL` when expression is not constant.

@ssaumitra
Copy link
Contributor Author

Fixes #15107 .

Copy link
Contributor

@rongrong rongrong left a comment

Choose a reason for hiding this comment

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

Code looks good! Thanks for fixing this!

@@ -5341,4 +5341,12 @@ public void testMultipleSqlFunctionsWithLambda()
"SELECT array_sum(zip_with(a, b, (x, y) -> x * y)), array_sum(zip_with(a, b, (x, y) -> x * y)) + array_sum(zip_with(a, a, (x, y) -> x * y)) FROM (VALUES (ARRAY[1, 2, 3], ARRAY[1, 0, 0])) t(a, b)",
"SELECT 1, 15");
}

@Test
public void testDistinctFrom()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add more tests to cover all code paths (both left and right)? Also since we are adding a generic test for IS DISTINCT FROM here, probably should also test for other common scenarios.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rongrong I have now added several more tests. Tests for basic cases are already in place in https://github.com/prestodb/presto/blob/0cfa23fd729a/presto-main/src/test/java/com/facebook/presto/sql/TestExpressionInterpreter.java#L226 . Therefore I would like to focus only on nested queries over here.

Copy link
Contributor

@rongrong rongrong left a comment

Choose a reason for hiding this comment

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

LGTM. @kaikalur do you want to take a look?

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.

IS DISTINCT FROM NULL gives wrong result when applied to columns with null values
2 participants