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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]