Skip to content

[GLUTEN-10574][VL][1.5] Backport #10541 to fix broadcast exchange stackoverflow due to Kryo serialization#10733

Merged
wForget merged 1 commit intoapache:branch-1.5from
wForget:branch-1.5
Sep 17, 2025
Merged

[GLUTEN-10574][VL][1.5] Backport #10541 to fix broadcast exchange stackoverflow due to Kryo serialization#10733
wForget merged 1 commit intoapache:branch-1.5from
wForget:branch-1.5

Conversation

@wForget
Copy link
Copy Markdown
Member

@wForget wForget commented Sep 17, 2025

Backport #10541 to branch-1.5

What changes are proposed in this pull request?

This pull request introduces a safer and more robust approach for handling Spark's BroadcastMode during serialization. The main improvement is the introduction of a new SafeBroadcastMode abstraction and related utilities, which help avoid serialization issues that caused a Stackoverflow exception during broadcast exchanges. BroadcastMode was introduced in this PR that caused the issue we observed. HashedRelationBroadcastMode embeds Catalyst expression trees, which are not safe to Kryo-serialize when running with spark.kryo.referenceTracking=false (default internally).

With this change, the broadcast payload now contains only primitives and byte arrays (no Catalyst trees). For bound keys, we serialize just column ordinals (+ null-aware flag) and for computed keys (e.g., upper(col)), we serialize the key expressions once as Java bytes and deserialize only where needed to build projections.

(cherry picked from commit 91c52e1)

…rialization (apache#10541)

This pull request introduces a safer and more robust approach for handling Spark's BroadcastMode during serialization. The main improvement is the introduction of a new SafeBroadcastMode abstraction and related utilities, which help avoid serialization issues that caused a Stackoverflow exception during broadcast exchanges. BroadcastMode was introduced in this PR that caused the issue we observed. HashedRelationBroadcastMode embeds Catalyst expression trees, which are not safe to Kryo-serialize when running with spark.kryo.referenceTracking=false (default internally).

With this change, the broadcast payload now contains only primitives and byte arrays (no Catalyst trees). For bound keys, we serialize just column ordinals (+ null-aware flag) and for computed keys (e.g., upper(col)), we serialize the key expressions once as Java bytes and deserialize only where needed to build projections.

(cherry picked from commit 91c52e1)
@github-actions github-actions bot added the VELOX label Sep 17, 2025
@github-actions
Copy link
Copy Markdown

#9671

@philo-he philo-he changed the title [GLUTEN-9671][VL][1.5] Fix broadcast exchange stackoverflow due to Kryo serialization [GLUTEN-10574][VL][1.5] Backport #10541 to fix broadcast exchange stackoverflow due to Kryo serialization Sep 17, 2025
@github-actions
Copy link
Copy Markdown

#10574

@wForget wForget merged commit 2c0f158 into apache:branch-1.5 Sep 17, 2025
54 checks passed
@wForget
Copy link
Copy Markdown
Member Author

wForget commented Sep 17, 2025

Thanks, merged to branch-1.5

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants