davisusanibar commented on PR #34312:
URL: https://github.com/apache/arrow/pull/34312#issuecomment-1487578283

   With version: 11.0.0
   ```
   java.lang.IllegalStateException: error loading native libraries: 
java.io.FileNotFoundException: x86_64\arrow_dataset_jni.dll
        at org.apache.arrow.dataset.jni.JniLoader.load(JniLoader.java:94)
        at 
org.apache.arrow.dataset.jni.JniLoader.loadRemaining(JniLoader.java:74)
        at 
org.apache.arrow.dataset.jni.JniLoader.ensureLoaded(JniLoader.java:61)
        at 
org.apache.arrow.dataset.jni.NativeMemoryPool.getDefault(NativeMemoryPool.java:34)
        at me.Recipe.main(Recipe.java:25)
   ```
   
   With new version arrow-dataset-12.0.0-SNAPSHOT: 
https://github.com/ursacomputing/crossbow/releases/tag/actions-b5ef0c7d3c-github-java-jars
   ```
   - wget 
https://github.com/ursacomputing/crossbow/releases/download/actions-b5ef0c7d3c-github-java-jars/arrow-dataset-12.0.0-SNAPSHOT.jar
   - mvn install:install-file 
"-Dfile=C:\Users\dsusanibar\jni\arrow-dataset-12.0.0-SNAPSHOT.jar" 
"-DgroupId=org.apache.arrow" "-DartifactId=arrow-dataset" 
"-Dversion=12.0.0-SNAPSHOT" "-Dpackaging=jar"
   ```
   
   Cookbook: 
https://arrow.apache.org/cookbook/java/dataset.html#query-data-content-for-file
   ```
   import org.apache.arrow.dataset.file.FileFormat;
   import org.apache.arrow.dataset.file.FileSystemDatasetFactory;
   import org.apache.arrow.dataset.jni.NativeMemoryPool;
   import org.apache.arrow.dataset.scanner.ScanOptions;
   import org.apache.arrow.dataset.scanner.Scanner;
   import org.apache.arrow.dataset.source.Dataset;
   import org.apache.arrow.dataset.source.DatasetFactory;
   import org.apache.arrow.memory.BufferAllocator;
   import org.apache.arrow.memory.RootAllocator;
   import org.apache.arrow.vector.VectorSchemaRoot;
   import org.apache.arrow.vector.ipc.ArrowReader;
   
   public class Recipe {
       public static void main(String[] args) {
           String uri = 
"file:///C:\\Users\\dsusanibar\\IdeaProjects\\win-cookbooks\\src\\main\\resources\\files\\data1.parquet";
           ScanOptions options = new ScanOptions(/*batchSize*/ 32768);
           try (
                   BufferAllocator allocator = new RootAllocator();
                   DatasetFactory datasetFactory = new 
FileSystemDatasetFactory(allocator, NativeMemoryPool.getDefault(), 
FileFormat.PARQUET, uri);
                   Dataset dataset = datasetFactory.finish();
                   Scanner scanner = dataset.newScan(options);
                   ArrowReader reader = scanner.scanBatches()
           ) {
               while (reader.loadNextBatch()) {
                   try (VectorSchemaRoot root = reader.getVectorSchemaRoot()) {
                       System.out.print(root.contentToTSVString());
                   }
               }
           } catch (Exception e) {
               e.printStackTrace();
           }
       }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to