[SPARK-55696][SQL] Add explicit error to Encoders.bean for interface class#54494
Open
szehon-ho wants to merge 4 commits intoapache:masterfrom
Open
[SPARK-55696][SQL] Add explicit error to Encoders.bean for interface class#54494szehon-ho wants to merge 4 commits intoapache:masterfrom
szehon-ho wants to merge 4 commits intoapache:masterfrom
Conversation
fdf4d19 to
c0a6a3e
Compare
cloud-fan
reviewed
Feb 26, 2026
| messageParameters = Map("name" -> name)) | ||
| } | ||
|
|
||
| def beanEncoderDoesNotSupportInterfaceError(className: String): |
Contributor
There was a problem hiding this comment.
if it's only used once we can inline it.
cloud-fan
approved these changes
Feb 26, 2026
pan3793
reviewed
Feb 26, 2026
| "Primitive types are not supported." | ||
| ] | ||
| }, | ||
| "_LEGACY_ERROR_TEMP_2231" : { |
Member
There was a problem hiding this comment.
Hmm... why add a LEGACY error condition?
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?
Add explicit error message to Encoders.bean against interfaces
Why are the changes needed?
For bean Encoders, the de-serializer uses the constructor inferred from the bean Encoder. ie, we get the bytes back, the Dataset deserialization will use the Encoder's interface class to try to construct , and fail.
Code ref:
spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/DeserializerBuildHelper.scala
Line 482 in b370375
Does this PR introduce any user-facing change?
No, it already fails today with another message:
it will now fail more explicitly.
How was this patch tested?
Added unit test in JavaDatasetSuite
Was this patch authored or co-authored using generative AI tooling?
Yes, cursor