[SPARK-52583][SQL] Add an Developer API for stringifying values in UserDefinedType #51289
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?
This PR proposes to add a Developer API for stringifying values in UserDefinedType. When casting a Class X instance that UserDefinedType represents in the Catalyst layer, this API will be called to get the string representation. The default implementation of this API is to call
obj.toString
with the AS-IS behavior.Why are the changes needed?
The Class X's toString method doesn't always meet the needs of users, and it's difficult for them to override it in some circumstances. For example, it's a JVM implementation or from other dependent projects.
This stringifyValue API gives a user or developer an extra opportunity to do the override.
Does this PR introduce any user-facing change?
No, it's a developer API addition and the behavior remains
How was this patch tested?
New test cases
Was this patch authored or co-authored using generative AI tooling?
no