You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "davisusanibar (via GitHub)" <gi...@apache.org> on 2023/04/04 16:31:42 UTC
[GitHub] [arrow] davisusanibar commented on issue #34850: [Java] pandas created arrow files cause exception in Java using ArrowFileReader API
davisusanibar commented on issue #34850:
URL: https://github.com/apache/arrow/issues/34850#issuecomment-1496273772
> I figured out what was causing it. Appears that adding explicit `compression='uncompressed'` on python export side will result in correct processing. Does `ArrowFileReader` support compression which is turned on by default on Python side?
Hi @tklinchik , use CommonsCompressionFactory for compressed files (Lz4/Zstd currently supported)
```
File file = new File("lz4.arrow");
try (
BufferAllocator rootAllocator = new RootAllocator();
FileInputStream fileInputStream = new FileInputStream(file);
// ArrowFileReader reader = new ArrowFileReader(fileInputStream.getChannel(), rootAllocator) // Use CommonsCompressionFactory for compressed files
ArrowFileReader reader = new ArrowFileReader(fileInputStream.getChannel(),
rootAllocator, CommonsCompressionFactory.INSTANCE)
) {
System.out.println("Record batches in file: " + reader.getRecordBlocks().size());
for (ArrowBlock arrowBlock : reader.getRecordBlocks()) {
reader.loadRecordBatch(arrowBlock);
VectorSchemaRoot vectorSchemaRootRecover = reader.getVectorSchemaRoot();
System.out.println("Size: --> " + vectorSchemaRootRecover.getRowCount());
System.out.print(vectorSchemaRootRecover.contentToTSVString());
}
} catch (IOException 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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org