Skip to content

⚡ Bolt: Add fast path for single batch build side in HashJoin#262

Open
Dandandan wants to merge 1 commit intomainfrom
bolt-hashjoin-fastpath-17536242971790051292
Open

⚡ Bolt: Add fast path for single batch build side in HashJoin#262
Dandandan wants to merge 1 commit intomainfrom
bolt-hashjoin-fastpath-17536242971790051292

Conversation

@Dandandan
Copy link
Copy Markdown
Owner

This PR introduces a performance optimization to the HashJoinExec operator. It adds a fast path to avoid an unnecessary concat_batches call when the build side of the join consists of a single RecordBatch, thereby reducing memory allocation and CPU overhead in this common scenario.


PR created automatically by Jules for task 17536242971790051292 started by @Dandandan

💡 What:
Adds a fast path to the `collect_left_input` function in `HashJoinExec`. If the build-side input stream consists of a single `RecordBatch`, this change avoids calling `concat_batches` and uses the batch directly.

🎯 Why:
The `concat_batches` function can be expensive, requiring new memory allocations and data copies. When the build side is already a single batch (a common case), this operation is unnecessary overhead.

📊 Impact:
Improves hash join performance and reduces memory allocation for joins where the build side is a single batch.

🔬 Measurement:
The correctness of this change is verified by the existing test suite (`cargo test -p datafusion-physical-plan`). The performance improvement is a micro-optimization that would be visible in targeted benchmarks.

Co-authored-by: Dandandan <163737+Dandandan@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant