drin commented on code in PR #227: URL: https://github.com/apache/arrow-cookbook/pull/227#discussion_r932518234
########## cpp/source/compute.rst: ########## @@ -0,0 +1,151 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +==================================== +Defining and Using Compute Functions +==================================== + +This section contains (or will contain) a number of recipes illustrating how to +define new "compute functions" or how to use existing ones. Arrow contains a "Compute +API," which primarily consists of a "registry" of functions that can be invoked. +Currently, Arrow populates a default registry with a variety of useful functions. The +recipes provided in this section show some approaches to define a compute function as well +as how to invoke a compute function by name, given a registry. + + +.. contents:: + +Invoke a Compute Function +========================= + +When invoking a compute function, the function must exist in a function registry. In this +recipe, we use `CallFunction()` to invoke the function with name "named_scalar_fn". + +.. recipe:: ../code/compute_fn.cc InvokeByCallFunction + :caption: Use CallFunction() to invoke a compute function by name + :dedent: 2 + +.. note:: + This method allows us to specify arguments as a vector and a custom ExecContext. + +If an `ExecContext` is not passed to `CallFunction` (it is null), then the default +FunctionRegistry will be used to call the function from. Review Comment: yeah, my code adds it then invokes it, but I also wanted to conceptually de-couple the 2. I think separate cookbook entries would have a lot of overlap, but I suppose it would make the concepts more accessible. For now, I can maybe re-word to mention that an empty ExecContext actually causes a default one to be used, and where I mention the link between ExecContext and FunctionRegistry above, I can say that the default ExecContext references the default FunctionRegistry -- 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]
