-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++] How to use CallFunction() when arg is a ExtensionScalar(ExtensionType) #39024
Comments
Just curious, where would |
Sorry, I have added some code to supplement the information. Registering Function will use
|
Thanks! I think @js8544 @bkietz @felipecrv Would you mind take a look for help? |
The problem occurs because the kernel you registered is for Int16, hence the However, I think it's worthwhile to provide general support for ExtensionTypes, and it's not hard to do so:
This way users can simply define their own extention types and reuse the existing compute functions. No need to write extra kernels and registrations etc. Does this sound like a viable approach? Also cc @pitrou. |
(Also I think writing a self-defined kernel for ExtensionType is not so hard, but it's better to have some examples?) |
I have now inherited and implemented the ExtensionType , which storage type is int16().
I want to use the ExtensionType's Array and Scalar to call a custom add function by CallFunction. The custom add function using the built-in Kernel for the two int16(). I also wrote a TypeMatcher to match the Kernel.
Currently, two ExtensionArrays can be added together successfully, but there is an issue when adding an ExtensionArray and an ExtensionScalar; it throws a std::bad_cast error.
After investigating, I found that the parent class of ExtensionScalar is Scalar, but it needs to be cast to PrimitiveScalarBase (whose parent class is also Scalar), which fails.
ExtensionType:
TypeMatcher
CallFunction
When I use 'ARROW_ASSIGN_OR_RAISE(incremented_datum,
arrow::compute::CallFunction("cxsadd", {ary1, scalar1})); ', program will abort and show this:
coredump file:
Component(s)
C++
The text was updated successfully, but these errors were encountered: