Skip to content

fix: preserve nulls in array_has_any/all empty-needle path - #24986

Merged
Jefffrey merged 1 commit into
apache:mainfrom
yashrb24:fix-24985-array-has-null-mask
Sep 7, 2026
Merged

fix: preserve nulls in array_has_any/all empty-needle path#24986
Jefffrey merged 1 commit into
apache:mainfrom
yashrb24:fix-24985-array-has-null-mask

Conversation

@yashrb24

@yashrb24 yashrb24 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

When every needle array in a batch is NULL or empty, array_has_any and
array_has_all use 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, []) returns false
  • array_has_all(array, []) returns true

What 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.

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Sep 6, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.67%. Comparing base (5b389eb) to head (30a955a).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Jefffrey
Jefffrey added this pull request to the merge queue Sep 7, 2026
@Jefffrey

Jefffrey commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

thanks for this @yashrb24, nice catch

Merged via the queue into apache:main with commit 2c31327 Sep 7, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

array_has_any/array_has_all results depend on other rows when needles are NULL

3 participants