Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

[NSE-191]Fix issue0191 for .so file copy to tmp. #192

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
/** Helper class for JNI related operations. */
public class JniUtils {
private static final String LIBRARY_NAME = "spark_columnar_jni";
private static final String ARROW_LIBRARY_NAME = "libarrow.so.300";
private static final String GANDIVA_LIBRARY_NAME = "libgandiva.so.300";
private static boolean isLoaded = false;
private static boolean isCodegenDependencyLoaded = false;
private static List<String> codegenJarsLoadedCache = new ArrayList<>();
Expand Down Expand Up @@ -77,6 +79,8 @@ private JniUtils(String _tmp_dir) throws IOException, IllegalAccessException, Il
try {
loadLibraryFromJar(tmp_dir);
} catch (IOException ex) {
System.load(ARROW_LIBRARY_NAME);
System.load(GANDIVA_LIBRARY_NAME);
System.loadLibrary(LIBRARY_NAME);
}
isLoaded = true;
Expand Down Expand Up @@ -108,6 +112,10 @@ static void loadLibraryFromJar(String tmp_dir) throws IOException, IllegalAccess
if (tmp_dir == null) {
tmp_dir = System.getProperty("java.io.tmpdir");
}
final File arrowlibraryFile = moveFileFromJarToTemp(tmp_dir, ARROW_LIBRARY_NAME);
System.load(arrowlibraryFile.getAbsolutePath());
final File gandivalibraryFile = moveFileFromJarToTemp(tmp_dir, GANDIVA_LIBRARY_NAME);
System.load(gandivalibraryFile.getAbsolutePath());
final String libraryToLoad = System.mapLibraryName(LIBRARY_NAME);
final File libraryFile = moveFileFromJarToTemp(tmp_dir, libraryToLoad);
System.load(libraryFile.getAbsolutePath());
Expand Down
5 changes: 5 additions & 0 deletions native-sql-engine/cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ macro(find_arrow)
message(STATUS "Gandiva Library Can Be Found in ${GANDIVA_LIB}")
endif()

file(COPY ${ARROW_LIB}.0.0 DESTINATION ${root_directory}/releases/)
file(COPY ${ARROW_LIB} DESTINATION ${root_directory}/releases/)
file(COPY ${GANDIVA_LIB}.0.0 DESTINATION ${root_directory}/releases/)
file(COPY ${GANDIVA_LIB} DESTINATION ${root_directory}/releases/)

target_link_libraries(spark_columnar_jni
LINK_PUBLIC ${ARROW_LIB} ${GANDIVA_LIB})
target_include_directories(spark_columnar_jni PUBLIC ${ARROW_INCLUDE_DIR})
Expand Down