niyue commented on code in PR #38116:
URL: https://github.com/apache/arrow/pull/38116#discussion_r1364803533


##########
cpp/src/gandiva/llvm_external_ir_store.h:
##########
@@ -0,0 +1,40 @@
+// 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.
+
+#pragma once
+
+#include <arrow/status.h>
+#include <gandiva/visibility.h>
+#include <llvm/Support/MemoryBuffer.h>
+#include <memory>
+#include <vector>
+
+namespace gandiva {
+using arrow::Status;
+
+class GANDIVA_EXPORT LLVMExternalIRStore {
+ public:
+  /// \brief add an LLVM IR to the store from a given bitcode file path
+  static Status Add(const std::string& bitcode_file_path);

Review Comment:
   > It would be much more flexible if this was a proper class that one can 
instantiate
   
   Currently, users of Gandiva uses `Projector`/`Filter` API to work with the 
expression, and projector/filter and their internal llvm generator/engine are 
created every time a new projector/filter is created, and function registry is 
used internally by the engine. However, we don't want users to register their 
functions every time, so there needs to have a global state storing the 
functions users register up front. Initially I implemented this a singleton to 
store the global state, and after discussing with @js8544 (see above), I change 
the singleton to static methods + an internal static variable to store the 
global state. Please advise if there is other approach for addressing this 
concern. 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]

Reply via email to