Conversation
Use a shared word bitmap that retains NULL keys and applies membership only to hash lookups. Count all observed rows when deciding whether to pause, with bounded exponential backoff. Align configuration types and metrics while preserving optional memory accounting and fallback. Standardize the 13 payload-bearing benchmark workloads and extend join, projection, fetch, and SQL regression coverage.
|
Thank you for opening this pull request! Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch). Details |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #25363 +/- ##
==========================================
+ Coverage 81.92% 81.95% +0.03%
==========================================
Files 1135 1136 +1
Lines 427573 428843 +1270
Branches 427573 428843 +1270
==========================================
+ Hits 350279 351474 +1195
- Misses 56367 56383 +16
- Partials 20927 20986 +59 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sunchao
left a comment
There was a problem hiding this comment.
Thanks @lyne7-sc. I reviewed c9414e2a02f4720b32d75b2b70091713d3b3a47e against merge base a0631edb774855faa999266003e23f939473d44e, including lookup semantics, integer boundaries, memory accounting, adaptive sampling, and the benchmark setup. I did not find an actionable defect.
Local validation:
- All 10 focused
integer_prefiltertests passed, including optional-memory fallback and independent adaptation with a shared build bitmap. - An independent physical-plan oracle passed 4,800 scenarios on the base and the same scenarios with the feature disabled and enabled on the PR head (14,400 executions total). It covered all 10 join types, both NULL equalities, residual filters, duplicate continuation with small output batches, reordered projections, fetch limits, empty/all-NULL inputs, sliced validity buffers, and CollectLeft/Partitioned execution. Enabled runs exercised bitmap creation and pruning.
- All 13 new benchmark workloads passed their result assertions with the feature both enabled and disabled.
Keeping the original probe rows and validity separate from lookup membership appears to preserve the outer/anti/mark semantics, and the reservation fallback tests passed. I have not independently reproduced the reported release-mode or TPC-H timings; the benchmark runs above checked results only. At review time, 40 checks had succeeded and three extended-suite checks were skipped.
Which issue does this PR close?
Rationale for this change
Hash joins can spend substantial time looking up probe keys that do not exist on the build side. For a single integer key with a bounded range, an exact membership bitmap can reject these keys cheaply before hash table lookup. This helps when many nonmatching keys reach the join, including when dynamic filters cannot be pushed down to the input.
For example, in the measured TPC-H SF1 plans, the
RightSemijoin onpart.p_partkey = lineitem.l_partkeyreceives approximately 6 million probe rows. With memtable inputs or the default Parquet configuration:These low probe hit rates leave substantial room to avoid unsuccessful lookups, reflected in both the query-latency and operator-level measurements below.
The extra membership check is less useful when most keys match. An adaptive policy pauses filtering when the observed pruning ratio is low and periodically samples again as the input changes.
What changes are included in this PR?
hash_join_probemicrobenchmark.What is the testing strategy for this PR?
hash_join_integer_prefilter.sltcovers duplicate matches, unmatched rows, NULL equality, inner/full/semi/anti joins, null-aware IN/NOT IN behavior, range limits, and creation/pruning metrics.Are there any user-facing changes?
The feature is opt-in and disabled by default. It can be enabled with:
Additional execution options control the maximum key range (default
262144), minimum pruning ratio (0.5), and sampling window (12288input rows). The metricsinteger_prefilter_created_countandprobe_prefilter_rows_prunedexpose whether the prefilter was created and how many probe rows skipped lookup.Query results are unchanged.
Benchmarks
Microbench:
hash_join_probeTPC-H with memtable
TPC-H with parquet
with the default
datafusion.execution.parquet.pushdown_filters=falseTarget HashJoin
join_timeThe following table measures the
CollectLeft/RightSemiHashMap join onpart.p_partkey = lineitem.l_partkeydescribed above. It reports operatorjoin_time, summed across the four probe partitions, separately from end-to-end query latency.