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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
