Skip to content

perf: Coalesce broadcast exchange batches before broadcasting#3703

Draft
mbutrovich wants to merge 2 commits intoapache:mainfrom
mbutrovich:coalesce_broadcast
Draft

perf: Coalesce broadcast exchange batches before broadcasting#3703
mbutrovich wants to merge 2 commits intoapache:mainfrom
mbutrovich:coalesce_broadcast

Conversation

@mbutrovich
Copy link
Contributor

@mbutrovich mbutrovich commented Mar 14, 2026

Which issue does this PR close?

Closes #3692.

Rationale for this change

CometBroadcastExchangeExec previously broadcast an Array[ChunkedByteBuffer] with one entry per source partition. Each consumer partition independently deserialized all entries, creating a separate compression codec and Arrow IPC reader per entry. For broadcasts with many source partitions, this produced large per-task overhead in the hash join build-side collection.

Screenshot 2026-03-13 at 4 05 03 PM

What changes are included in this PR?

Decode and concatenate all broadcast batches into a single ChunkedByteBuffer on the driver using VectorSchemaRootAppender before broadcasting. Falls back to per-batch serialization if dictionary-encoded vectors are present.

How are these changes tested?

Existing tests.

CometBroadcastExchangeExec previously broadcast an Array[ChunkedByteBuffer] with one entry per source partition. Each consumer partition independently deserialized all entries, creating a separate compression codec and Arrow IPC reader per entry. For broadcasts with many source partitions, this produced large per-task overhead in the hash join build-side collection.

Decode and concatenate all broadcast batches into a single ChunkedByteBuffer on the driver using VectorSchemaRootAppender before broadcasting. Falls back to per-batch serialization if dictionary-encoded vectors are present.
@mbutrovich
Copy link
Contributor Author

In addition to TPC-H, I will see if we can come up with a microbenchmark for this.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize CometBroadcastHashJoin: use CollectLeft partition mode and cache deserialized broadcast batches

1 participant