perf(arrow): evaluate In/NotIn with a hash set for byte, string, and integer columns#619
Open
jordepic wants to merge 1 commit into
Open
perf(arrow): evaluate In/NotIn with a hash set for byte, string, and integer columns#619jordepic wants to merge 1 commit into
jordepic wants to merge 1 commit into
Conversation
…integer columns The residual evaluator (shared by the parquet row filter and the exact batch backstop) combined one comparison kernel per literal, making a pushed-down In predicate O(rows x literals). Engines probing a batch of keys against a table push hundreds of literals at a time, which turned each probe quadratic. Build a hash set of the literal values once and answer membership in a single pass over the column for the common column shapes; anything else keeps the per-literal loop, including its error behavior for unconvertible literals.
Author
|
cc @JingsongLi — companion to #618; would appreciate your review. |
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.
Purpose
Linked issue: close #617
The shared residual evaluator (used by both the parquet row filter and the exact batch backstop) evaluates
In/NotInas one comparison kernel per literal, OR-combining the masks — O(rows × literals). An engine pushing a batch of point-lookup keys as anInpredicate makes every table probe quadratic.Brief change log
set_membership_hash_mask: build a hash set of the literal values once, answer membership in a single pass over the column, for Binary/LargeBinary/BinaryView, Utf8/LargeUtf8/Utf8View, and Int8–Int64 columns.Noneand falls back to the existing per-literal loop, preserving its exact semantics including its error behavior for unconvertible literals.falsefor bothInandNotIn, matching the loop'ssanitize_filter_maskconvention.Tests
test_in_hash_path_filters_exactly_with_nulls,test_not_in_hash_path_excludes_nulls,test_in_hash_path_on_binary_column(In and NotIn masks incl. nulls),test_in_unconvertible_literal_still_errors(error behavior preserved through the fallback).cargo test -p paimon --lib arrow::residual(26),read_builder(33), andarrow::format::parquet(41) all pass.API and Format
None — internal evaluation only; results are unchanged.
Documentation
Doc comment on the fast path explains the shape and the fallback contract.