apache / apache/arrow-java

JVM failed when use gandiva udf with dynamic libraries

オープン
#326 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Type: bug
主要言語
Java
スター
94
フォーク
152
平均マージ
3日 16時間
マージ済み PR(30日)
11

説明

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'
```java

// code placeholder
#ifndef MYTEST_H
#define MYTEST_H
#ifdef __cplusplus
extern "C"{
#endif
float testSim();
#ifdef __cplusplus
}
#endif
#endif
```
2 Add simple code for the udf in file 'string_ops.cc'

 
```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;
}
```
 

3 Add function details in the function registry file 'function_registry_string.cc'
```java

// code placeholder
NativeFunction("test_sim", {}, DataTypeVector{binary(),binary()},float32(),
kResultNullIfNull, "sim_binary_binary", NativeFunction::kNeedsContext | NativeFunction::kCanReturnErrors)
```
4 Create test functions

5 Add link to the CMakeLists.txt

5 compile and test

6 write a java demo to call the udf

[hs_err_pid28288.log](hs_err_pid28288.log)

**Environment**: OS:Centos7.4
llvm:7.0.1
jdk:1.8.0_162
arrow:1.0.0
**Reporter**: [Leo89](https://issues.apache.org/jira/browse/ARROW-9624)
#### Original Issue Attachments:
- [hs_err_pid28288.log](https://issues.apache.org/jira/secure/attachment/13008955/hs_err_pid28288.log)

**Note**: *This issue was originally created as [ARROW-9624](https://issues.apache.org/jira/browse/ARROW-9624). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず hs_err_pid28288.log を確認し、libmytest.so を使用した Gandiva UDF への Java 呼び出しを再現します。string_ops.cc、function_registry_string.cc、CMakeLists.txt における native UDF の変更を追跡し、C++ パスと Java パスを比較します。Java デモが JVM の障害を引き起こさなくなり、dynamic-library UDF が引き続き呼び出し可能であれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp, java
領域
backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。