Search in sources :

Example 1 with FieldVector

use of org.apache.arrow.vector.FieldVector in project flink by apache.

the class ArrowUtils method createRowDataArrowWriter.

/**
 * Creates an {@link ArrowWriter} for the specified {@link VectorSchemaRoot}.
 */
public static ArrowWriter<RowData> createRowDataArrowWriter(VectorSchemaRoot root, RowType rowType) {
    ArrowFieldWriter<RowData>[] fieldWriters = new ArrowFieldWriter[root.getFieldVectors().size()];
    List<FieldVector> vectors = root.getFieldVectors();
    for (int i = 0; i < vectors.size(); i++) {
        FieldVector vector = vectors.get(i);
        vector.allocateNew();
        fieldWriters[i] = createArrowFieldWriterForRow(vector, rowType.getTypeAt(i));
    }
    return new ArrowWriter<>(root, fieldWriters);
}
Also used : FieldVector(org.apache.arrow.vector.FieldVector) ArrowFieldWriter(org.apache.flink.table.runtime.arrow.writers.ArrowFieldWriter)

Aggregations

FieldVector (org.apache.arrow.vector.FieldVector)1 ArrowFieldWriter (org.apache.flink.table.runtime.arrow.writers.ArrowFieldWriter)1