Skip to content

fix: CAST(MapType AS MapType) falls back even though native ...#4559

Open
gittihub-jpg wants to merge 1 commit into
apache:mainfrom
gittihub-jpg:fix/issue-20260601-4491
Open

fix: CAST(MapType AS MapType) falls back even though native ...#4559
gittihub-jpg wants to merge 1 commit into
apache:mainfrom
gittihub-jpg:fix/issue-20260601-4491

Conversation

@gittihub-jpg
Copy link
Copy Markdown

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.

…#4491)

Fixes apache#4491

Signed-off-by: gittihub-jpg <rico@springer-mail.net>
@gittihub-jpg gittihub-jpg marked this pull request as ready for review June 1, 2026 20:37
@andygrove
Copy link
Copy Markdown
Member

Thanks @gittihub-jpg. The changes look reasonable but I don't see any tests in the PR?

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.

[Feature] CAST(MapType AS MapType) falls back even though native cast_map_to_map exists

2 participants