-
Notifications
You must be signed in to change notification settings - Fork 107
Closed as not planned
Labels
Type: enhancementNew feature or requestNew feature or request
Description
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.
public List<VectorSchemaRoot> readArrowBatches(String rows, BufferAllocator allocator) {
final List<VectorSchemaRoot> 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()).toVectorSchemaRoot());
}
} 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.
Metadata
Metadata
Assignees
Labels
Type: enhancementNew feature or requestNew feature or request