niyue commented on PR #38116:
URL: https://github.com/apache/arrow/pull/38116#issuecomment-1772407022
Upon discussion above, I plan to make some additional changes, and the API
may look like this:
1) I will re-use and expose the `FunctionRegistry` class for users when
registering external functions, but instead of the current
static-member-global-state approach, I will follow pitrou's suggestion to make
it a `an instantiable class, with per-instance state, and also a global default
instance`
2) I will remove the `LLVMExternalBitcodeStore` class, and its current
logic/data will be part of `FunctionRegistry`
3) I will make `Projector`/`Filter`/`LLVMGenerator`/`Engine` to accept a
`FunctionRegistry *` pointer in the during class construction, and they will
store the pointer internally for later usage. Its usage will be somewhat
similar like `arrow::MemoryPool *` in current arrow code base. By default, a
global default instance `default_function_registry()` will be used. If user of
Gandiva provides her own `FunctionRegistry`, it's user's responsibility to make
sure the `FunctionRegistry *` lifetime is correct.
4) For `Projector`/`Filter`/`LLVMGenerator`, they already accepts a
`std::shared_ptr<Configuration> config` in the constructor, I plan to add
function registry to be part of the `Configuration`, something like this:
```
class GANDIVA_EXPORT Configuration {
public:
friend class ConfigurationBuilder;
// ....
explicit Configuration(bool optimize, FunctionRegistry *function_registry
= gandiva::default_function_registry()) : optimize_(optimize),
target_host_cpu_(true), function_registry_(function_registry) {}
// ....
private:
bool optimize_; /* optimise the generated llvm IR */
bool target_host_cpu_; /* set the mcpu flag to host cpu while compiling
llvm ir */
FunctionRegistry* function_registry_; // <==== this is newly added
};
```
@js8544 @pitrou @kou
What do you think about this? I will follow up to make the change if this is
okay. Thanks.
--
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]