Search in sources :

Example 1 with ArrowStreamReader

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);
}
Also used : ArrowStreamReader(org.apache.arrow.vector.ipc.ArrowStreamReader)

Example 2 with ArrowStreamReader

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();
}
Also used : ArrowStreamReader(org.apache.arrow.vector.ipc.ArrowStreamReader) ArrowStreamWriter(org.apache.arrow.vector.ipc.ArrowStreamWriter)

Example 3 with ArrowStreamReader

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);
}
Also used : ArrowStreamReader(org.apache.arrow.vector.ipc.ArrowStreamReader)

Aggregations

ArrowStreamReader (org.apache.arrow.vector.ipc.ArrowStreamReader)3 ArrowStreamWriter (org.apache.arrow.vector.ipc.ArrowStreamWriter)1