You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "twuebi (via GitHub)" <gi...@apache.org> on 2026/07/29 13:38:08 UTC

[PR] fix(arrow/compute): support casting between extension types [arrow-go]

twuebi opened a new pull request, #1052:
URL: https://github.com/apache/arrow-go/pull/1052

   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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(arrow/compute): support casting between extension types [arrow-go]

Posted by "twuebi (via GitHub)" <gi...@apache.org>.
twuebi closed pull request #1052: fix(arrow/compute): support casting between extension types
URL: https://github.com/apache/arrow-go/pull/1052


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(arrow/compute): support casting between extension types [arrow-go]

Posted by "twuebi (via GitHub)" <gi...@apache.org>.
twuebi commented on PR #1052:
URL: https://github.com/apache/arrow-go/pull/1052#issuecomment-5194134231

   Oh, yes, you're right. Storage cannot decide this, going to close this.
   
   Tried to fix an issue that popped up with iceberg-go geo type casts, where the same geoarrow.wkb type with different CRS metadata (SRID vs authority code) on the file and table sides. Just different labels for the same thing, [apache/iceberg-go#1599](https://github.com/apache/iceberg-go/issues/1599) solved this on the correct layer already, trying to push it into this layer was wrong.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(arrow/compute): support casting between extension types [arrow-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on PR #1052:
URL: https://github.com/apache/arrow-go/pull/1052#issuecomment-5193939066

   > 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.
   
   This isn't technically valid at all since the semantics of the different extension types might be different even though the underlying storage type is compatible. For example, consider a cast from UUID (fixed-size-binary [16]) to JSON (String):
   
   - If we're just unwrapping the input and casting the storage that means we do a fsb[16] -> utf8 cast
   - If the bytes for the UUID *happen* to be valid utf8, it'll create a gibberish string rather than create a string version of the UUID
   - Even if it created a valid UUID string, that wouldn't be valid JSON and thus would create an invalid JSON extension array.
   
   Essentially, casting between extension types MUST take into account the semantics, so we can't create a generic extension type cast like this which just performs a cast of the underlying storage and wrapping it in the new extension. What is the specific case you're trying to support with this generic kernel? If it's casting between extension types that are defined in arrow-go, we can add specific kernels for those types in here. Otherwise, it might make more sense to just implement and register the kernels you need inside the package you want to use it in.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org