Skip to content

[SPARK-55708][SQL] TransformingEncoder with primitive inside OptionEncoder#54506

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

[SPARK-55708][SQL] TransformingEncoder with primitive inside OptionEncoder#54506
eejbyfeldt wants to merge 1 commit intoapache:masterfrom
eejbyfeldt:SPARK-55708

Conversation

@eejbyfeldt
Copy link
Contributor

@eejbyfeldt eejbyfeldt commented Feb 26, 2026

What changes were proposed in this pull request?

Make it possible to use TransformingEncoder from a primitive type and have that inside an OptionEncoder.

Supports for primitives using TransformingEncoder was initially improved in #51313 but it was missed that it did not work inside an OptionEncoder. The fix here also cleans up how javaClassToPrimitiveType is computed, it was missed that the values in typeJavaMapping are not unique and the previous code would assign wrong types for some classes.

Why are the changes needed?

To make the AgnosticEncoders as flexible as Expression based encoders were, this will allow libraries providing custom encoders to move to Spark 4.0.0 and beyond.

Does this PR introduce any user-facing change?

Yes, libraries trying to derive custom encoders with have more flexibility.

How was this patch tested?

Existing and new unittests.

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

No.

Fix bug when a transformingEncoder from primitive is used inside an
OptionEncoder.
@eejbyfeldt eejbyfeldt marked this pull request as ready for review February 26, 2026 13:59
@eejbyfeldt
Copy link
Contributor Author

@hvanhovell @chris-twiner here is another issue I ran into trying to move to the AgnosticEncoders. Would be great if someone could have review.

@eejbyfeldt eejbyfeldt changed the title SPARK-55708: TransformingEncoder with primitive inside OptionEncoder [SPARK-55708][SQL] TransformingEncoder with primitive inside OptionEncoder Feb 26, 2026
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