tisonkun opened a new issue, #465:
URL: https://github.com/apache/arrow-java/issues/465
### Describe the enhancement requested
I'm writing a convertor method to convert a base64 encoded byte array into
Arrow batches and returns it to the user.
```java
public List<Table> readArrowBatches(String rows, BufferAllocator
allocator) {
final List<Table> batches = new ArrayList<>();
final byte[] data = Base64.getDecoder().decode(rows);
final ByteArrayInputStream stream = new ByteArrayInputStream(data);
try (final ArrowStreamReader reader = new ArrowStreamReader(stream,
allocator)) {
while (reader.loadNextBatch()) {
batches.add(new Table(reader.getVectorSchemaRoot()));
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return batches;
}
```
Since `ArrowStreamReader` replace the batch referred by
`getVectorSchemaRoot` in each iteration, I have to do a deepcopy of
VectorSchemaRoot every time.
Currently, I use Table's method as a workaround, but wonder if
`VectorSchemaRoot` deserves a `copy` method, or I implement such a typically
use case in a wrong way.
--
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]