datafusion-contrib / datafusion-java

Java binding to Apache DataFusion
Apache License 2.0
70 stars 13 forks source link

Cannot startup a demo application with datafusion-java #90

Open fishblue opened 1 year ago

fishblue commented 1 year ago

Maven Pom.xml

<dependency>
      <groupId>io.github.datafusion-contrib</groupId>
      <artifactId>datafusion-java</artifactId>
      <version>0.15.0</version>
</dependency>

Code:

SessionContext context = SessionContexts.create();
System.out.println(context.sql("select 1.5 + sqrt(2.0)").get());

Exception:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/jg/1m0ncz_12ls78p9f8lq094880000gn/T/datafusion_jni6452691470670684444.dylib: dlopen(/private/var/folders/jg/1m0ncz_12ls78p9f8lq094880000gn/T/datafusion_jni6452691470670684444.dylib, 0x0001): tried: '/private/var/folders/jg/1m0ncz_12ls78p9f8lq094880000gn/T/datafusion_jni6452691470670684444.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/jg/1m0ncz_12ls78p9f8lq094880000gn/T/datafusion_jni6452691470670684444.dylib' (no such file), '/private/var/folders/jg/1m0ncz_12ls78p9f8lq094880000gn/T/datafusion_jni6452691470670684444.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
no datafusion_jni in java.library.path
Unsupported OS/arch (`Osx' detected), cannot find `/jni_libs/libdatafusion_jni.dylib' or load `datafusion_jni' from system libraries. Please try building from source the jar or providing datafusion_jni in your system.
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
    at java.lang.Runtime.loadLibrary0(Runtime.java:843)
    at java.lang.System.loadLibrary(System.java:1136)
    at org.apache.arrow.datafusion.JNILoader.load(JNILoader.java:95)
    at org.apache.arrow.datafusion.SessionContexts.<clinit>(SessionContexts.java:23)
    at com.tencent.metric.DatafusionMQL.main(DatafusionMQL.java:29)

Environment System: Mac Apple M1 Pro JDK: 1.8 & 11

jimexist commented 1 year ago

M1 is not a supported hardware type by GitHub action which is used to build the final artifacts https://repo.maven.apache.org/maven2/io/github/datafusion-contrib/datafusion-java/0.15.0/ - as you can see, only x86_64 is built and packaged.

to run the example, try ./gradlew clean copyDevLibrary run from the checked out source root.