niyue commented on code in PR #37787:
URL: https://github.com/apache/arrow/pull/37787#discussion_r1330209041
##########
cpp/src/gandiva/function_registry_test.cc:
##########
@@ -93,4 +94,36 @@ TEST_F(TestFunctionRegistry, TestNoDuplicates) {
"different precompiled functions:\n"
<< stream.str();
}
+
+TEST_F(TestFunctionRegistry, LookupExternalFuncs) {
+ ExtensionDirSetter ext_dir_setter("extended_funcs", []() {
+ FunctionRegistry::pc_registry_.clear();
+ FunctionRegistry::pc_registry_map_ = FunctionRegistry::InitPCMap();
+ });
+
+ FunctionSignature multiply_by_two_int32("multiply_by_two", {arrow::int32()},
+ arrow::int64());
+ auto func = registry_.LookupSignature(multiply_by_two_int32);
+ EXPECT_NE(func, nullptr);
+ EXPECT_EQ(func->pc_name(), "multiply_by_two_int32");
+}
+
+TEST_F(TestFunctionRegistry, LookupMultipleFuncs) {
+ ExtensionDirSetter ext_dir_setter("multiple_functions_registry", []() {
+ FunctionRegistry::pc_registry_.clear();
+ FunctionRegistry::pc_registry_map_ = FunctionRegistry::InitPCMap();
Review Comment:
It is a bit tricky to unit test the function registry, I manually set the
environment variable for the extension dir and reload the registry to get it
tested
--
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]