js8544 commented on PR #35787:
URL: https://github.com/apache/arrow/pull/35787#issuecomment-1611056184
> This mostly looks good to me. However, in light of the strong relationship
between this Function and subtract I'd prefer to see more reuse of that
function's existing logic. For example when retrieving the output type for
pairwise_diff($in_type), couldn't we just as easily call subtract's
DispatchExact with ($in_type, $in_type)? And instead of referencing Subtract's
Ops directly, couldn't we use the kernel retrieved from subtract's
DispatchExact- just passing the relevant slices of the input as the arguments
to the subtract kernel? I think this would have negligible impact on
performance and would greatly reduce the future maintenance burden for this
function, since any new types added to subtract will then automatically be
supported by pairwise_diff.
Hi @bkietz, do you mean something like this:
```cpp
auto subtract_func = registry->GetFunction("subtract").ValueOrDie();
for (const auto& type : types) {
auto kernel = subtract_func->DispatchExact({type, type}).ValueOrDie();
// reuse kernel's exec and signature
}
```
--
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]