You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Leo89 (Jira)" <ji...@apache.org> on 2020/08/03 11:07:00 UTC

[jira] [Created] (ARROW-9627) JVM failed when use gandiva udf with dynamic libraries

Leo89 created ARROW-9627:
----------------------------

             Summary: JVM failed when use gandiva udf with dynamic libraries
                 Key: ARROW-9627
                 URL: https://issues.apache.org/jira/browse/ARROW-9627
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++ - Gandiva, Java
         Environment: OS:Centos7.4
llvm:7.0.1
jdk:1.8.0_162
arrow:1.0.0
            Reporter: Leo89


Hi there,

Recently I'm trying to add some UDF with dynamic link libaries. It is fine compiling and running test in cpp, but when I call the udf from java, JVM failed with errors.

Steps to reproduce the issue
1 Prepare dynamic library 'libmytest.so'
{code:java}
// code placeholder
#ifndef MYTEST_H
#define MYTEST_H
#ifdef __cplusplus
extern "C"{
#endif
 float testSim();
#ifdef __cplusplus
}
#endif
#endif
{code}
 

2 Add simple code for the udf in file 'string_ops.cc'
{code:java}
// code placeholder
FORCE_INLINEFORCE_INLINE
gdv_float32 test_sim_binary_binary(gdv_int64 context, const char* left, gdv_int32 left_len, const char* right,  gdv_int32 right_len) {
 float sim = testSim();
 return sim;
}
{code}

3 Add function details in the function registry file 'function_registry_string.cc'
{code:java}
// code placeholder
NativeFunction("test_sim", {}, DataTypeVector{binary(),binary()},float32(),
 kResultNullIfNull, "sim_binary_binary", NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors),
{code}
4 Create test functions

5 Add link to the CMakeLists.txt

5 compile and test

6 write a java demo to call the udf



--
This message was sent by Atlassian Jira
(v8.3.4#803005)