Skip to content

Fix Spanner write mutation coder serialization#5919

Open
NA-V10 wants to merge 1 commit intospotify:mainfrom
NA-V10:fix-spanner-mutation-coder
Open

Fix Spanner write mutation coder serialization#5919
NA-V10 wants to merge 1 commit intospotify:mainfrom
NA-V10:fix-spanner-mutation-coder

Conversation

@NA-V10
Copy link
Copy Markdown

@NA-V10 NA-V10 commented Apr 5, 2026

Summary

This change explicitly sets spannerMutationCoder on the SCollection[Mutation] before applying the Beam Spanner write transform.

Previously, the write path relied on Beam/Kryo fallback serialization, which could lead to UnsupportedOperationException when serializing Mutation / MutationGroup.

Changes Made

  • Materialized spannerMutationCoder using CoderMaterializer.beam
  • Applied the coder to the input SCollection[Mutation]
  • Updated the write path to use data.setCoder(coder).applyInternal(transform)

Why

A spannerMutationCoder already exists in CoderInstances, but it was not being explicitly used in SpannerWrite. This change ensures that Beam uses the intended serializer for Mutation objects during writes.

@NA-V10
Copy link
Copy Markdown
Author

NA-V10 commented Apr 5, 2026

Thanks for reporting this issue.

I updated the Spanner write path to explicitly use spannerMutationCoder before applying the Beam write transform. Since the coder already existed in CoderInstances, the fix was mainly wiring it into SpannerWrite so Beam does not fall back to Kryo serialization for Mutation objects.

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.

1 participant