fix: preserve nulls in array_has_any/all empty-needle path - #24986
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24986 +/- ##
==========================================
- Coverage 81.67% 81.67% -0.01%
==========================================
Files 1126 1126
Lines 414524 414525 +1
Branches 414524 414525 +1
==========================================
- Hits 338558 338546 -12
- Misses 56054 56062 +8
- Partials 19912 19917 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Jefffrey
approved these changes
Sep 7, 2026
Contributor
|
thanks for this @yashrb24, nice catch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
array_has_any/array_has_allresults depend on other rows when needles are NULL #24985.Rationale for this change
When every needle array in a batch is NULL or empty,
array_has_anyandarray_has_alluse an empty-needle fast path.That path currently drops the input null masks, so a row can return a different
result depending on the contents of another row in the batch.
What changes are included in this PR?
Preserves the combined null mask from the haystack and needle when constructing
the fast-path result.
Non-NULL empty needles will keep the existing behavior:
array_has_any(array, [])returnsfalsearray_has_all(array, [])returnstrueWhat is the testing strategy for this PR?
Added a SQLLogicTest covering this edge case
Are there any user-facing changes?
Yes. NULL input rows now return NULL consistently in the empty-needle path.
There is no API change.