Skip to content

fix: [branch-1.1] keep the values of sliced batches when coalescing a broadcast (#6900) - #7328

Open
laxmanmamididd wants to merge 1 commit into
apache:branch-1.1from
laxmanmamididd:backport/6900-branch-1.1
Open

laxmanmamididd wants to merge 1 commit into
apache:branch-1.1from
laxmanmamididd:backport/6900-branch-1.1

Conversation

@laxmanmamididd

Copy link
Copy Markdown

Which issue does this PR close?

Backport of #6900 to branch-1.1. Closes #6779 on this branch.

Rationale for this change

branch-1.1 has the bug fixed on main by #6900: a broadcast hash join drops matching rows when the build side emits sliced string or binary batches. Native DISTINCT, grouped aggregates and window operators emit such batches, and coalesceBroadcastBatches appends them with VectorSchemaRootAppender, which assumes offsets that start at zero.

We hit it on a production Spark job on Comet 1.1.0. Output was missing 24 of 724,405 rows. At an inner join on a 16-character string key, vanilla Spark produced 30,410 rows and CometBroadcastHashJoin produced 30,407 from identical inputs. With spark.comet.exec.broadcastHashJoin.enabled=false the output matched vanilla exactly.

What changes are included in this PR?

Cherry-pick of 66c63bd (#6900). The ffi.md hunk is placed above this branch's "Wrapper Object Lifecycle" heading because the heading differs from main.

How are these changes tested?

UtilsSuite passes on branch-1.1 with -Pspark-4.0 on JDK 17, and the new test serializeBatches rebases offsets that start past zero fails without the change to Utils.scala. CometJoinSuite needs the native library and has not been run locally; CI will run it.

🤖 Generated with Claude Code

… broadcast (apache#6900)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the bug Something isn't working label Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants