You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "zanmato1984 (via GitHub)" <gi...@apache.org> on 2024/06/12 12:56:04 UTC

Re: [I] [C++] Compute: Why here arrow::compute has MetaFunction [arrow]

zanmato1984 commented on issue #41926:
URL: https://github.com/apache/arrow/issues/41926#issuecomment-2162943019

   > In arrow compute, `MetaFunction` means some "sepcial function", which "dispatch implementation to other impl. And the introduced pr is here: [199d089](https://github.com/apache/arrow/commit/199d089e6343df1a1aa95f75b9e99e05a2702257)
   
   As I understand it, a meta function gives you a structural way to bypass all the routines to actually invoke a regular function: executor creation, dispatching (kernel lookup), initialization, etc. So it's suitable for things like checking input "shape" and dispatch to concrete overloads (CC/CA/AC/etc.), or any other thing that you feel best to implement a function without using kernels. 
   
   > However, some function like "CAST" also has correspond kernel, and it just works like a normal function.
   
   IIUC, `cast`, as a meta function, has no kernel. What you saw might be subclasses of
   https://github.com/apache/arrow/blob/383ffe06075c5b66e2c7a37bfaf91a84aeb453d2/cpp/src/arrow/compute/cast_internal.h#L35
   What is a arguably strange though, is that these concrete `cast_xxx` functions are not registered in the global function registry. Instead, `cast` meta function manages them using an internal registry-like structure:
   https://github.com/apache/arrow/blob/383ffe06075c5b66e2c7a37bfaf91a84aeb453d2/cpp/src/arrow/compute/cast.cc#L49
   
   >  Besides, why should it has a MetaFunction rather rathan a function with some "Match Any" Kernels?
   
   Well, I would say that probably is technically doable. I think people just chose one.


-- 
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