js8544 commented on code in PR #37752: URL: https://github.com/apache/arrow/pull/37752#discussion_r1333957495
########## cpp/src/gandiva/exported_funcs_registry_test.cc: ########## @@ -0,0 +1,28 @@ +// 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. + +#include "gandiva/exported_funcs_registry.h" +#include <gtest/gtest.h> +#include "gandiva/exported_funcs.h" + +namespace gandiva { +TEST(ExportedFuncsRegistry, RegistrationOnlyOnce) { + gandiva::RegisterExportedFuncs(); + auto const& registered_list = ExportedFuncsRegistry::registered(); + EXPECT_EQ(registered_list.size(), 6); Review Comment: Can we make the registered function public, to make it simpler? And so that code doesn't need to know about tests. I think hard coding the number of functions is fine. ########## cpp/src/gandiva/engine.cc: ########## @@ -88,6 +89,7 @@ std::once_flag llvm_init_once_flag; static bool llvm_init = false; static llvm::StringRef cpu_name; static llvm::SmallVector<std::string, 10> cpu_attrs; +std::once_flag register_exported_funcs_flag; Review Comment: I see. Then having an explicit init process is necessary. -- 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]
