Skip to content

fix(arrow/compute): support casting between extension types - #1052

Open
twuebi wants to merge 1 commit into
apache:mainfrom
twuebi:fix/compute-extension-to-extension-cast
Open

fix(arrow/compute): support casting between extension types#1052
twuebi wants to merge 1 commit into
apache:mainfrom
twuebi:fix/compute-extension-to-extension-cast

Conversation

@twuebi

@twuebi twuebi commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Casts are dispatched on the target type, and the cast function registered for extension targets only accepted NULL inputs. Casting an extension array to a different extension type therefore failed with "function 'cast_extension' has no kernel matching input types" even when the cast between the two storage types is well defined, while the reverse direction (extension input, concrete target) has always been handled by the generic CastFromExtension unwrap kernel.

Register a generic extension -> extension kernel that unwraps the input array, casts its storage to the target's storage type honoring the caller's cast options, and rewraps the result as the target extension type. Re-typing between extension types that share a storage type is zero-copy since the inner storage cast is then a no-op.

Also correct the GetCommonCastKernels doc comment, which claimed to return kernels for casting from extension types; it only ever returned the cast-from-null kernel.

Casts are dispatched on the target type, and the cast function
registered for extension targets only accepted NULL inputs. Casting an
extension array to a different extension type therefore failed with
"function 'cast_extension' has no kernel matching input types" even when
the cast between the two storage types is well defined, while the
reverse direction (extension input, concrete target) has always been
handled by the generic CastFromExtension unwrap kernel.

Register a generic extension -> extension kernel that unwraps the input
array, casts its storage to the target's storage type honoring the
caller's cast options, and rewraps the result as the target extension
type. Re-typing between extension types that share a storage type is
zero-copy since the inner storage cast is then a no-op.

Also correct the GetCommonCastKernels doc comment, which claimed to
return kernels for casting from extension types; it only ever returned
the cast-from-null kernel.
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