fix: CAST(MapType AS MapType) falls back even though native ...#4559
Open
gittihub-jpg wants to merge 1 commit into
Open
fix: CAST(MapType AS MapType) falls back even though native ...#4559gittihub-jpg wants to merge 1 commit into
gittihub-jpg wants to merge 1 commit into
Conversation
…#4491) Fixes apache#4491 Signed-off-by: gittihub-jpg <rico@springer-mail.net>
Member
|
Thanks @gittihub-jpg. The changes look reasonable but I don't see any tests in the PR? |
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.
Closes #4491.
Rationale for this change
CometCast.isSupported lacks a MapType arm, so any cast involving map types hits the default case and falls back to Spark. The native implementation already supports map-to-map conversion via cast_map_to_map in cast.rs. Routing Scala casts to this function removes unnecessary fallbacks and improves execution performance.
What changes are included in this PR?
Add a case for (MapType, MapType) in CometCast.isSupported. The new logic recursively checks key types and value types using isSupported. It returns Compatible when both recursive checks pass, or Incompatible with a descriptive reason string otherwise. No Rust changes are required since the native cast_map_to_map function already exists.
How are these changes tested?
Existing unit tests for CometCast cover type compatibility checks. The new MapType branch is validated by running the full test suite and verifying that map-to-map casts no longer trigger a fallback to Spark.