Fix ARRAYS_OVERLAP function bug#23845
Conversation
29f4c0c to
25c73bc
Compare
kewang1024
left a comment
There was a problem hiding this comment.
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
4ef0f7a to
bad00d9
Compare
| } | ||
| } | ||
| else { | ||
| checkElementNotNull(leftArray.isNull(i), ARRAY_NULL_ELEMENT_MSG); |
There was a problem hiding this comment.
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).
| if (elementType.equalTo(leftArray, i, rightArray, j)) { | ||
| return true; | ||
| try { | ||
| if (elementType.equalTo(leftArray, i, rightArray, j)) { |
There was a problem hiding this comment.
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.
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 ==