Repository navigation
perf: replace the routed hash join dynamic filter with one global filter (InList or bloom filter) - #26442
perf: replace the routed hash join dynamic filter with one global filter (InList or bloom filter)#26442adriangb wants to merge 9 commits into
Conversation
|
run benchmarks |
|
run benchmarks env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: true |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark clickbench_partitionedResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark tpcdsResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark tpchResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark clickbench_partitioned
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"Results will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark tpch
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"Results will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark tpcds
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"Results will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark tpchCPU Details (lscpu)Details
Resource Usagetpch — base (merge-base)
tpch — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark tpch
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"CPU Details (lscpu)Details
Resource Usagetpch — base (merge-base)
tpch — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark tpcdsCPU Details (lscpu)Details
Resource Usagetpcds — base (merge-base)
tpcds — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark tpcds
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"CPU Details (lscpu)Details
Resource Usagetpcds — base (merge-base)
tpcds — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark clickbench_partitioned
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"CPU Details (lscpu)Details
Resource Usageclickbench_partitioned — base (merge-base)
clickbench_partitioned — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark clickbench_partitionedCPU Details (lscpu)Details
Resource Usageclickbench_partitioned — base (merge-base)
clickbench_partitioned — branch
File an issue against this benchmark runner |
|
run benchmark tpch10 env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: true |
|
run benchmark tpch10 env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: false |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark tpch10
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "false"Results will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark tpch10
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"Results will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark tpch10
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "false"CPU Details (lscpu)Details
Resource Usagetpch10 — base (merge-base)
tpch10 — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (885155a) to 5f21582 (merge-base) diff Run configurationrun benchmark tpch10
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"CPU Details (lscpu)Details
Resource Usagetpch10 — base (merge-base)
tpch10 — branch
File an issue against this benchmark runner |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #26442 +/- ##
========================================
Coverage 82.92% 82.93%
========================================
Files 1154 1155 +1
Lines 457872 458727 +855
Branches 457872 458727 +855
========================================
+ Hits 379712 380465 +753
- Misses 55136 55217 +81
- Partials 23024 23045 +21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
run benchmark tpch10 baseline:
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: false
changed:
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: true |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (9638f9e) to 5f21582 (merge-base) diff Run configurationrun benchmark tpch10
baseline:
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "false"
changed:
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"Results will be posted here when complete File an issue against this benchmark runner |
There was a problem hiding this comment.
🟡 Changes recommended
Critical buffer-retention and allocation-accounting defects can overcommit the memory pool or exhaust process memory, while dictionary concatenation can abort valid joins.
11 open issues
Make hash-collision test expectations collision-aware · New Bound or reserve ArrayMap bloom-filter scratch memory · New Release partition bloom filters after global finalization · New Clear finalized report payloads to release reservations · New Handle dictionary overflow when merging partition keys · New Keep the temporary filter reservation alive through merging · New Apply the size limit to the rounded bloom-filter allocation · New Test file-partitioned joins end to end · New Compute bloom membership for prepared byte-key builds · New Use partition bounds instead of unioning dense key lists · New Restore bitmap pruning coverage for bounds and casts · New
What changed in this PR
Replaces partition-routed hash-join dynamic filters with one global InList or bloom filter. This enables probe filtering across more input partitionings while preserving min/max and key-range bitmap pruning.
Changes:
- Builds and merges bloom filters with configurable size, false-positive, and memory limits.
- Removes routed hash lookups and allows dynamic filtering regardless of input partitioning.
- Updates pruning, serialization, regression tests, and CI configuration.
| File | Description |
|---|---|
xtask/src/ci_steps.rs |
Removes the obsolete legacy-fuzzer command and tests. |
docs/source/contributor-guide/api-health.md |
Uses a generic name in the internal-API example. |
datafusion/sqllogictest/test_files/push_down_filter_parquet.slt |
Updates expected filters and NULL-handling comments. |
datafusion/sqllogictest/test_files/information_schema.slt |
Adds expectations for four configuration options. |
datafusion/sqllogictest/test_files/dynamic_row_group_pruning.slt |
Adds statistics-only pruning coverage and updates plans. |
datafusion/pruning/src/pruning_predicate.rs |
Extracts bitmap pruning from BloomFilterExpr. |
datafusion/pruning/Cargo.toml |
Removes the unused rstest dependency. |
datafusion/proto/tests/cases/plans/exprs.rs |
Removes the retired lookup-expression roundtrip test. |
datafusion/physical-plan/src/repartition/mod.rs |
Removes the unused range-routing helper. |
datafusion/physical-plan/src/joins/stream_join_utils.rs |
Implements entry-hash iteration for pruning join maps. |
datafusion/physical-plan/src/joins/mod.rs |
Re-exports BloomFilterExpr and simplifies map reservations. |
datafusion/physical-plan/src/joins/join_hash_map.rs |
Adds JoinHashMapType::for_each_entry_hash. |
datafusion/physical-plan/src/joins/hash_join/stream.rs |
Reports build keys and partition filters to the accumulator. |
datafusion/physical-plan/src/joins/hash_join/shared_bounds.rs |
Constructs global membership, bounds, and merged bitmap filters. |
datafusion/physical-plan/src/joins/hash_join/partitioned_hash_eval.rs |
Removes HashTableLookupExpr and PartitionRouter; retains hashing. |
datafusion/physical-plan/src/joins/hash_join/mod.rs |
Registers and re-exports the bloom-filter implementation. |
datafusion/physical-plan/src/joins/hash_join/exec/prepared/tests.rs |
Updates prepared-build membership assertions. |
datafusion/physical-plan/src/joins/hash_join/exec/prepared.rs |
Supplies partition-count information during preparation. |
datafusion/physical-plan/src/joins/hash_join/exec.rs |
Builds partition filters, removes routing restrictions, and updates tests. |
datafusion/physical-plan/src/joins/hash_join/build.rs |
Includes key data in build reports. |
datafusion/physical-plan/src/joins/hash_join/bloom_filter.rs |
Adds BloomFilterExpr, its has_filter, pruning_bitmap, and on_columns accessors, runtime serialization, and tests. |
datafusion/physical-plan/src/joins/array_map.rs |
Extracts representative rows for distinct keys. |
datafusion/physical-plan/Cargo.toml |
Adds the Parquet dependency for Sbbf. |
datafusion/core/tests/physical_optimizer/filter_pushdown.rs |
Updates bloom-filter expectations in pushdown tests. |
datafusion/common/src/config.rs |
Adds hash_join_dynamic_filter_inlist_max_distinct_values, hash_join_bloom_filter_fpp, hash_join_bloom_filter_max_bytes, and hash_join_bloom_filter_max_fpp. |
Cargo.lock |
Records dependency changes. |
.github/workflows/extended.yml |
Removes the retired legacy-fuzzer step. |
Review effort: Max
| let false_positives = result.iter().filter(|v| **v).count() - 2000; | ||
| assert!(false_positives < 200, "{false_positives} false positives"); |
| let rows = array_map.distinct_rows(); | ||
| let keys = left_values | ||
| .iter() | ||
| .map(|values| take(values.as_ref(), &rows, None)) | ||
| .collect::<std::result::Result<Vec<_>, _>>()?; |
| values: normalized_values, | ||
| bounds, | ||
| membership, | ||
| bloom_filter, |
| pub(crate) keys: Vec<ArrayRef>, | ||
| /// Bloom filter of the keys. `None` when this partition has no filter, | ||
| /// then the global filter has no bloom filter. | ||
| pub(crate) bloom_filter: Option<Arc<Sbbf>>, |
| pool: &Arc<dyn MemoryPool>, | ||
| ) -> Result<Option<Sbbf>> { | ||
| let arrays: Vec<&dyn Array> = in_lists.iter().map(|a| a.as_ref()).collect(); | ||
| let values = arrow::compute::concat(&arrays)?; |
| let bytes = (bits / 8.0) as usize; | ||
| (bytes <= self.max_bytes).then_some(bytes) |
| // The partitioning of the inputs does not matter. The filter holds the | ||
| // keys of every build partition whose stream can probe, so it passes | ||
| // every row that a stream can join. | ||
| true |
| // so the finalizing task only ORs the partition filters. Partitions hold | ||
| // disjoint keys of similar counts, so the filter is sized for the keys of | ||
| // all partitions estimated from this one. | ||
| let bloom_filter = if !should_compute_dynamic_filters |
| _ => p | ||
| .build_keys | ||
| .keys | ||
| .first() | ||
| .map(|keys| KeyRangePart::Keys(keys.as_ref())), |
| fn build_key_range_bitmap_pruning_expr( | ||
| bitmap: &Arc<KeyRangeBitmap>, | ||
| on_columns: &[&Arc<dyn PhysicalExpr>], |
|
run benchmark tpch10 env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: true |
|
run benchmark tpch10 env:
DATAFUSION_EXECUTION_TARGET_PARTITIONS: 128
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: true |
|
run benchmark tpch10 env:
DATAFUSION_EXECUTION_TARGET_PARTITIONS: 128
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: false |
|
run benchmark tpcds env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: true |
|
run benchmark tpcds env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: false |
|
run benchmark hj env:
DATAFUSION_EXECUTION_TARGET_PARTITIONS: 128
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: true |
|
run benchmark imdb env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: true |
|
run benchmark hj baseline:
env:
DATAFUSION_EXECUTION_TARGET_PARTITIONS: 128
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: true
changed:
env:
DATAFUSION_EXECUTION_TARGET_PARTITIONS: 128
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: true
DATAFUSION_OPTIMIZER_HASH_JOIN_DYNAMIC_FILTER_INLIST_MAX_DISTINCT_VALUES: 150 |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark hj
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"
DATAFUSION_EXECUTION_TARGET_PARTITIONS: "128"Trigger commentResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark tpcds
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "false"Trigger commentResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark tpch10
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"
DATAFUSION_EXECUTION_TARGET_PARTITIONS: "128"Trigger commentResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark tpch10
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "false"
DATAFUSION_EXECUTION_TARGET_PARTITIONS: "128"Trigger commentResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark tpcds
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"Trigger commentResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark imdb
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"Trigger commentResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark tpch10
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"Trigger commentResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark tpcds
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"Trigger commentCPU Details (lscpu)Details
Resource Usagetpcds — base (merge-base)
tpcds — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark tpch10
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"
DATAFUSION_EXECUTION_TARGET_PARTITIONS: "128"Trigger commentCPU Details (lscpu)Details
Resource Usagetpch10 — base (merge-base)
tpch10 — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark tpch10
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"Trigger commentCPU Details (lscpu)Details
Resource Usagetpch10 — base (merge-base)
tpch10 — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark tpch10
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "false"
DATAFUSION_EXECUTION_TARGET_PARTITIONS: "128"Trigger commentCPU Details (lscpu)Details
Resource Usagetpch10 — base (merge-base)
tpch10 — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark hj
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"
DATAFUSION_EXECUTION_TARGET_PARTITIONS: "128"Trigger commentCPU Details (lscpu)Details
Resource Usagehj — base (merge-base)
hj — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark tpcds
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "false"Trigger commentCPU Details (lscpu)Details
Resource Usagetpcds — base (merge-base)
tpcds — branch
File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark hj
baseline:
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"
DATAFUSION_EXECUTION_TARGET_PARTITIONS: "128"
changed:
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"
DATAFUSION_EXECUTION_TARGET_PARTITIONS: "128"
DATAFUSION_OPTIMIZER_HASH_JOIN_DYNAMIC_FILTER_INLIST_MAX_DISTINCT_VALUES: "150"Trigger commentResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark hj
baseline:
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"
DATAFUSION_EXECUTION_TARGET_PARTITIONS: "128"
changed:
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"
DATAFUSION_EXECUTION_TARGET_PARTITIONS: "128"
DATAFUSION_OPTIMIZER_HASH_JOIN_DYNAMIC_FILTER_INLIST_MAX_DISTINCT_VALUES: "150"Trigger commentCPU Details (lscpu)Details
Resource Usagehj — base (merge-base)
hj — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing hash-join-global-bloom-filter (b31e2d9) to 20dbe06 (merge-base) diff Run configurationrun benchmark imdb
env:
DATAFUSION_EXECUTION_PARQUET_PUSHDOWN_FILTERS: "true"Trigger commentCPU Details (lscpu)Details
Resource Usageimdb — base (merge-base)
imdb — branch
File an issue against this benchmark runner |
Review of apache#26442 found cases where the global filter lost keys, kept memory, or pruned wrongly. This commit: - gives prepared builds a bloom filter and counts it in their reservation, - uses the bloom filter when dictionary InLists overflow the limit together, - builds the filter from the latest collect-left report, - releases the build data once the filter is built, - prunes containers with the key range bitmap only through widening casts, - iterates the distinct rows of an `ArrayMap` without a copy. A sqllogictest checks that the filter prunes files of a range-partitioned probe side. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orts Each build partition sized its bloom filter from its own number of keys times the number of partitions. With skewed keys this lost the filter for the whole join: one partition with many keys made the estimate too large, and one small partition that reported first made the filter too small, so it saturated. The filters also reserved memory while other partitions were still building, so a query could fail under a memory limit that is enough on main. Now each partition reports its number of distinct keys and a handle to its build data. After the last report, the join decides between an InList, no filter (too large) and a bloom filter of the exact size. Then the tasks that wait for the filter fill it together: each task takes partitions from a queue into one borrowed filter, and the tasks OR their filters as they finish. The number of filters is at most the number of tasks that help, and the last reporter fills what no task takes, so a task that is not polled blocks nobody. The accumulator holds only weak references to the build data. The plan owns the accumulator, so a strong reference would keep the build data of a dropped stream until the plan is dropped. A stream that is dropped never probes, so its keys are not needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a single integer key has every value between its min and max, the bounds predicate already tests membership exactly. A bloom filter then rejects no row and costs a hash and a lookup for each probe row (hj Q3 and Q17). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


Which issue does this PR close?
Rationale for this change
This PR attacks 3 different issues with the current HashJoin dynamic filters:
But maybe more importantly: this brings us in line with what most other systems do. The main question is what the probe side scan tests rows against when there are many build keys: a bloom filter, or the join's hash table (by reference or as a copy). I surveyed DuckDB, Polars, ClickHouse, Spark, Trino, Presto, Impala, Doris, Databend, Flink, Hive, Velox and StarRocks, which do join pushdown via dynamic filters or similar mechanisms, and found:
hash_lookuponmainreferences the hash tables directly.Survey by system (source read on 2026-11-30, links pinned to commits)
from_buildersSharedFixedHashTableRuntimeFilterJoinDomainBuilderTypedSetRuntimeFiltermergeSbbf(3M build rows)Sbbfin_bloom_filtergetFilterThe end result is also less code in DataFusion (this PR is currently -200LOC, despite adding tests, etc.).
What changed
For a partitioned hash join with many build keys, the dynamic filter on
mainis a routedhash_lookup: each probe row is hashed to its build partition and looked up in that partition's hash table. This has three costs:This PR replaces it with one global filter that does not depend on partitioning:
How the bloom filter is built:
Example (
dynamic_row_group_pruning.slt):Benchmark bot, total time against
main(negative is faster), with the number of queries (faster / slower) in parentheses. Each number links to its run. These are the latest runs, from 2026-11-20:The runs compare
95b97450fwith its merge-base7e3d65161. The bot has not run on the current head. Since those runs, the filter is sized after all partitions report (see above).Local runs of the current head against
main(a 16-core arm64 VM, SF10, median sum of query times, 4 alternating rounds):Skewed build sides (20M probe rows, median ms): one partition with 200K of 201K keys at 128 partitions takes 41.8 ms on
mainand 34.8 ms here. One partition with 1,100 keys and 11 with 300K keys at 12 partitions takes 78.3 ms and 48.5 ms. A build side too large for a bloom filter (10M keys, 1024 partitions) takes 1,065 ms onmainand 1,098 ms here: it keeps only the bounds.What changes are included in this PR?
New options:
hash_join_dynamic_filter_inlist_max_distinct_values20hash_join_bloom_filter_fpp0.01hash_join_bloom_filter_max_bytes8388608(8 MiB)hash_join_bloom_filter_max_fpp0.15All four are under
datafusion.optimizer. The existing per-partitionhash_join_inlist_pushdown_max_distinct_valueskeeps its meaning.datafusion-physical-plannow depends onparquet(forSbbf).What is the testing strategy for this PR?
bloom_filter.rs: membership, NULL keys, a filter that does not depend on skew or report order, tasks that share the filters the pool fits, size and fpp limits, memory reservation, errors, multi-column and float keys, proto.shared_bounds.rs: filter shape, InList vs bloom filter at the limit, canceled partitions, memory pool fallback, merged bounds and bitmap.exec.rs: the filter is allowed for any partitioning. After the plan is dropped, the memory pool holds only the bloom filter. A dropped stream releases its build data.dynamic_row_group_pruning.slt: row groups are pruned by the merged bitmap withpushdown_filters = false.filter_pushdown.rsand several.sltfiles.Are there any user-facing changes?
EXPLAINshowsbloom_filterinstead ofhash_lookupin hash join dynamic filters.HashTableLookupExprandPartitionRouter(public, doc-hidden) are removed.Open questions
mainkeeps an exacthash_lookup(about +3% in the 10M-key case above).🤖 Generated with Claude Code