perf: Optimize NULL handling in find_in_set#21464
Merged
mbutrovich merged 3 commits intoapache:mainfrom Apr 10, 2026
Merged
Conversation
This reverts commit 6146fe4.
Contributor
Author
|
Btw I tried refactoring this to use an explicit |
find_in_set NULL handlingfind_in_set
mbutrovich
approved these changes
Apr 10, 2026
Contributor
mbutrovich
left a comment
There was a problem hiding this comment.
Thanks for continually improving performance, @neilconway!
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?
find_in_set#21463.Rationale for this change
find_in_setusesPrimitiveArray::<T>::builderto construct its results, which means building the internal null buffer in an iterative fashion (via repeatedappend_nullcalls). It is more efficient to construct the null buffer directly, viaNullBuffer::union(when multiple arguments might be NULL) or just cloning the input null buffer (when passed a single argument).Benchmarks (ARM64):
The change should be an improvement for both scalar and array cases. The relative improvement is larger in the scalar case because the scalar case is doing less work and so NULL handling was a larger fraction of the total runtime.
What changes are included in this PR?
Are these changes tested?
Yes.
Are there any user-facing changes?
No.