Skip to content

[SPARK-55742][SQL] Support TransformingEncoder inside RowEncoder#54539

Open
eejbyfeldt wants to merge 1 commit intoapache:masterfrom
eejbyfeldt:SPARK-55742
Open

[SPARK-55742][SQL] Support TransformingEncoder inside RowEncoder#54539
eejbyfeldt wants to merge 1 commit intoapache:masterfrom
eejbyfeldt:SPARK-55742

Conversation

@eejbyfeldt
Copy link
Contributor

@eejbyfeldt eejbyfeldt commented Feb 27, 2026

What changes were proposed in this pull request?

Change expected type in ValidateExternalType for TransformingEncoder. Specifically I am trying to create a custom encoders for named tuples in Scala3 https://docs.scala-lang.org/scala3/reference/other-new-features/named-tuples.html this means we want the fields to be named, but the corresponding jvm accessor does not exists. This means that existing ProductEncoder can not be used.

Pre Spark 4 this could easily be solved by a custom Expression based encoder. This fix allows the same in Spark 4 by make it possible to use TransformingEncoders inside RowEncoder. This means that custom named tuple encoder can be created using a transforming encoder to a Row and then appropriate custom encoders for each field.

Why are the changes needed?

This allows more flexible use of RowEncoder when creating custom encoders.

Does this PR introduce any user-facing change?

Yes, it will allow more custom encoders to be created.

How was this patch tested?

Existing and new unit tests.

Was this patch authored or co-authored using generative AI tooling?

No.

@eejbyfeldt eejbyfeldt changed the title SPARK-55742: Support TransformingEncoder inside RowEncoder [SPARK-55742][SQL] Support TransformingEncoder inside RowEncoder Feb 27, 2026
@eejbyfeldt
Copy link
Contributor Author

@hvanhovell @chris-twiner Here is the third and final (at least for now) trying to migrate to use only agnostic encoders. Would be awesome if someone could have a look :)

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