-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Fix ARRAYS_OVERLAP function bug #23845
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
Conversation
29f4c0c
to
25c73bc
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.
Thanks @infvg for the fix, this makes sense to me, @rschlussel was looking at this issue before, let's have her review this PR as well
presto-main/src/test/java/com/facebook/presto/type/TestArrayOperators.java
Outdated
Show resolved
Hide resolved
4ef0f7a
to
bad00d9
Compare
} | ||
} | ||
else { | ||
checkElementNotNull(leftArray.isNull(i), ARRAY_NULL_ELEMENT_MSG); |
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.
this is not right. we intentionally throw for equals comparison with nulls for arrays and maps (and if we did change it, we would want to return false rather than throw).
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.
Removed
if (elementType.equalTo(leftArray, i, rightArray, j)) { | ||
return true; | ||
try { | ||
if (elementType.equalTo(leftArray, i, rightArray, j)) { |
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.
equalTo should be throwing on null input. Instead we should pass the IS_DISTINCT_FROM method handle and call that instead of equal to (and additionally pass it to the TypedSet for the set based implementation). You can look at TypedSet.isContainedAt for how it calls the distinct from method handle. Additionally, you can look at ArrayIntersectFunction for how the method handle gets passed in.
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.
Added the implementation
@infvg , are you available to work on this? |
fe6a8a5
to
66af0c0
Compare
The linking of the release note entry to the PR has been automated and the manual addition of the PR link is no longer needed. Also, you can link directly to the documentation of the function, as shown.
|
In some arrays containing arrays that contain null values, arrays_overlap was not properly comparing values. Switch to array_overlap to set based implementation. Resolves: prestodb#23730
Description
In some arrays containing arrays that contain null values, arrays_overlap was not properly comparing values. Switch array_overlap to set based implementation.
Motivation and Context
Fixes #23730
Impact
None
Test Plan
Added the failing functions to unit tests and ran testArraysOverlap to confirm the functionality for the other queries remains the same.
== RELEASE NOTES ==