[GLUTEN-11708][VL] Translate might_contain as a subfield filter for scan-level bloom filter pushdown#11711
Open
acvictor wants to merge 3 commits intoapache:mainfrom
Open
[GLUTEN-11708][VL] Translate might_contain as a subfield filter for scan-level bloom filter pushdown#11711acvictor wants to merge 3 commits intoapache:mainfrom
acvictor wants to merge 3 commits intoapache:mainfrom
Conversation
afcb288 to
15f1a6f
Compare
15f1a6f to
0258168
Compare
Contributor
Author
|
@zhztheplayer can you please review this PR? |
zhztheplayer
reviewed
Mar 9, 2026
Comment on lines
+37
to
+41
| try { | ||
| evaluator->evaluate(exprSet.get(), rows, input, result); | ||
| } catch (const VeloxUserError&) { | ||
| return nullptr; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Errors are intentionally swallowed because a non-evaluable expression simply means the filter cannot be pushed down. So if the filter cannot be pushed down, leafCallToSubfieldFilter returns std::nullopt, and Velox will evaluate might_contain as a regular post-scan expression which is the same behavior as before. Does this flow make sense? I have updated the comment as well.
| } | ||
|
|
||
| /// Filter backed by Velox's BloomFilter<> serialized data from bloom_filter_agg. | ||
| class SparkBloomFilter final : public common::Filter { |
Member
There was a problem hiding this comment.
Let's use SparkMightContain or so to align with Spark's function name.
| serializedData_(std::move(serializedData)) {} | ||
|
|
||
| bool testInt64(int64_t value) const final { | ||
| return BloomFilter<>::mayContain(serializedData_.data(), folly::hasher<int64_t>()(value)); |
Member
There was a problem hiding this comment.
We can create a bloom filter object as class member, since bloomFilter.mayContain is faster than BloomFilter<>::mayContain.
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.
What changes are proposed in this pull request?
This PR adds support for pushing
might_contain(bloomFilter, value) down into Velox's subfield filter system viaSparkExprToSubfieldFilterParser. Previously,might_containwas evaluated as a post-scan expression. With this change, the bloom filter check can be applied at the storage scan level allowing entire row groups to be skipped before data is fully decoded.Velox has two incompatible bloom filter implementations:
bloom_filter_agg/might_contain(groups-of-64-bits, 4 hash functions)BigintValuesUsingBloomFilterfilter class (SIMD split-block)Since these are not interchangeable, a new
SparkBloomFilterfilter class is introduced that wraps the serializedBloomFilter<>data and implementstestInt64()usingBloomFilter<>::mayContain()withfolly::hasher<int64_t>() which is the same code path used by the JNImightContainLongOnSerializedBloom.How was this patch tested?
Added new test suite covering basic filtering, null bloom filter, negation, non-column value, range test, and clone behavior.
Was this patch authored or co-authored using generative AI tooling?
No
Related issue #11708