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

Commit

Permalink
Fix issue0191 for .so file copy to tmp. (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
weiting-chen authored Mar 24, 2021
1 parent cc95f28 commit 6fbf0fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
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

0 comments on commit 6fbf0fc

Please sign in to comment.