You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Haowei Yu (Jira)" <ji...@apache.org> on 2020/08/06 04:28:00 UTC
[jira] [Created] (ARROW-9661) [Java] Failed to read arrow IPC
streaming format
Haowei Yu created ARROW-9661:
--------------------------------
Summary: [Java] Failed to read arrow IPC streaming format
Key: ARROW-9661
URL: https://issues.apache.org/jira/browse/ARROW-9661
Project: Apache Arrow
Issue Type: Improvement
Components: Java
Affects Versions: 1.0.0
Reporter: Haowei Yu
I have some bytes, which are in IPC streaming format, but Java failed to read data and give me back error
```
java.io.IOException: Expected schema but header was 0
```
Here is my java code
```
BufferAllocator allocator = new RootAllocator(Long._MAX_VALUE_);
ArrayList<ValueVector> valueVectors = new ArrayList<>();
final ArrayList<List<ValueVector>> batchOfVectors = new ArrayList<>();
final RootAllocator rootAllocator = new RootAllocator();
InputStream inputStream = new FileInputStream("/tmp/arrowdata");
try (ArrowStreamReader reader = new ArrowStreamReader(inputStream, allocator); ) {
VectorSchemaRoot root = reader.getVectorSchemaRoot();
while (reader.loadNextBatch()) {
valueVectors = new ArrayList<>();
for (FieldVector f : root.getFieldVectors()) {
// transfer will not copy data but transfer ownership of memory
// from streamReader to resultChunk
TransferPair t = f.getTransferPair(rootAllocator);
t.transfer();
valueVectors.add(t.getTo());
}
batchOfVectors.add(valueVectors);
root.clear();
}
}
```
--
This message was sent by Atlassian Jira
(v8.3.4#803005)