use of org.apache.arrow.vector.ipc.ArrowStreamReader in project flink by apache.
the class ArrowSerializer method resetReader.
public void resetReader() throws IOException {
arrowReader = null;
arrowStreamReader.close();
arrowStreamReader = new ArrowStreamReader(bais, allocator);
}
use of org.apache.arrow.vector.ipc.ArrowStreamReader in project flink by apache.
the class ArrowSerializer method open.
public void open(InputStream bais, OutputStream baos) throws Exception {
this.bais = bais;
this.baos = baos;
allocator = ArrowUtils.getRootAllocator().newChildAllocator("allocator", 0, Long.MAX_VALUE);
arrowStreamReader = new ArrowStreamReader(bais, allocator);
rootWriter = VectorSchemaRoot.create(ArrowUtils.toArrowSchema(inputType), allocator);
arrowWriter = createArrowWriter();
arrowStreamWriter = new ArrowStreamWriter(rootWriter, null, baos);
arrowStreamWriter.start();
}
use of org.apache.arrow.vector.ipc.ArrowStreamReader in project flink by apache.
the class ArrowReaderWriterTest method createArrowReader.
@Override
public ArrowReader createArrowReader(InputStream inputStream) throws IOException {
ArrowStreamReader reader = new ArrowStreamReader(inputStream, allocator);
reader.loadNextBatch();
return ArrowUtils.createArrowReader(reader.getVectorSchemaRoot(), rowType);
}
Aggregations