pronzato commented on issue #315: URL: https://github.com/apache/arrow-cookbook/issues/315#issuecomment-1646049023
Thank you David - will try this over the weekend. Is there any possibility this would make it into 13.0.0? On Sat, Jul 15, 2023 at 3:17 PM david dali susanibar arce < ***@***.***> wrote: > Hi @pronzato <https://github.com/pronzato>. I appreciate you pointing out > the HDFS issue. With this PR, HDFS will be enabled by default on Java > Dataset module apache/arrow#36704 > <https://github.com/apache/arrow/pull/36704> > > As a result of the new changes, I am now able to read HDFS parquet files, > but the program will not shut down for some reason. > > 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.ipc.ArrowReader;import org.apache.arrow.vector.types.pojo.Schema; > public class ReadHdfsParquet { > public static void main(String[] args) { > //declare JVM environment variable: HADOOP_HOME = /Users/dsusanibar/hadoop-3.3.2 > //where to search for: lib/native/libhdfs.dylib > String uri = "hdfs://localhost:9000/Users/dsusanibar/data4_2rg_gzip.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() > ) { > Schema schema = scanner.schema(); > System.out.println(schema); > while (reader.loadNextBatch()) { > System.out.println(reader.getVectorSchemaRoot().contentToTSVString()); > System.out.println("RowCount: " + reader.getVectorSchemaRoot().getRowCount()); > } > } catch (Exception e) { > e.printStackTrace(); > } > } > } > > [image: image] > <https://user-images.githubusercontent.com/4554485/253766626-8e3d4f72-de1c-471f-93a7-fdbd8d9060ed.png> > > — > Reply to this email directly, view it on GitHub > <https://github.com/apache/arrow-cookbook/issues/315#issuecomment-1636861035>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/ACO7PHBDGVTO7JKVLJTZOADXQLUFVANCNFSM6AAAAAA2DO2TY4> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> > -- 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]
