refactor: Make CollectLeftAccumulator a trait for custom left-side accumulators#116
Merged
peasee merged 32 commits intospiceai-50from Nov 26, 2025
Merged
refactor: Make CollectLeftAccumulator a trait for custom left-side accumulators#116peasee merged 32 commits intospiceai-50from
peasee merged 32 commits intospiceai-50from
Conversation
…ds instead of computing them after data is accumulated (apache#17444)
Author
|
Physical planner tests - failure is unrelated to changes, and due to feature flagging: |
There was a problem hiding this comment.
Pull request overview
This PR refactors the hash join bounds accumulation system to support custom accumulator implementations through traits. The refactor maintains backward compatibility by providing a default MinMaxLeftAccumulator implementation while enabling consumers to implement custom accumulator logic.
Key changes:
- Introduces
CollectLeftAccumulatorandColumnBoundstraits for extensibility - Renames
CollectLeftAccumulatorstruct toMinMaxLeftAccumulatorandColumnBoundsstruct toMinMaxColumnBounds - Makes
HashJoinExecgeneric over the accumulator type withMinMaxLeftAccumulatoras the default - Exposes previously internal types and functions through public APIs to support custom implementations
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| datafusion/pruning/src/pruning_predicate.rs | Exposes internal utilities (BoolVecBuilder, build_statistics_record_batch, StatisticsType) as public APIs |
| datafusion/pruning/src/lib.rs | Re-exports newly public types from pruning_predicate module |
| datafusion/physical-plan/src/joins/mod.rs | Re-exports new trait types and renamed accumulator from hash_join module |
| datafusion/physical-plan/src/joins/hash_join/shared_bounds.rs | Introduces ColumnBounds trait, renames ColumnBounds struct to MinMaxColumnBounds, updates types to use trait objects |
| datafusion/physical-plan/src/joins/hash_join/mod.rs | Re-exports new public types (CollectLeftAccumulator, MinMaxLeftAccumulator, ColumnBounds) |
| datafusion/physical-plan/src/joins/hash_join/exec.rs | Makes HashJoinExec generic over accumulator type, introduces CollectLeftAccumulator trait, renames struct to MinMaxLeftAccumulator, adds try_new_with_accumulator method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
phillipleblanc
approved these changes
Nov 26, 2025
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.
CollectLeftAccumulatorstruct toMinMaxLeftAccumulatorCollectLeftAccumulatorand implements it forMinMaxLeftAccumulatorHashJoinExec::try_newto set a default accumulator forMinMaxLeftAccumulator. This ensures the refactor is not a breaking change by defaulting the generic type.ColumnBoundstoMinMaxColumnBoundsColumnBoundstrait which returnsArc<dyn PhysicalExpr>representing the expression for the bounds returned by the accumulator. Implements it forMinMaxColumnBoundsThis refactor maintains existing min-max bounds functionality, while providing the ability for consumers to override
HashJoinExec's with custom accumulators for their specific use case.