[SPARK-55742][SQL] Support TransformingEncoder inside RowEncoder#54539
Open
eejbyfeldt wants to merge 1 commit intoapache:masterfrom
Open
[SPARK-55742][SQL] Support TransformingEncoder inside RowEncoder#54539eejbyfeldt wants to merge 1 commit intoapache:masterfrom
eejbyfeldt wants to merge 1 commit intoapache:masterfrom
Conversation
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 :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Change expected type in
ValidateExternalTypefor 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
Rowand 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.