pub struct ArrowWriter<W: Write> { /* private fields */ }
Expand description

Arrow writer

Writes Arrow RecordBatches to a Parquet writer, buffering up RecordBatch in order to produce row groups with max_row_group_size rows. Any remaining rows will be flushed on close, leading the final row group in the output file to potentially contain fewer than max_row_group_size rows

let col = Arc::new(Int64Array::from_iter_values([1, 2, 3])) as ArrayRef;
let to_write = RecordBatch::try_from_iter([("col", col)]).unwrap();

let mut buffer = Vec::new();
let mut writer = ArrowWriter::try_new(&mut buffer, to_write.schema(), None).unwrap();
writer.write(&to_write).unwrap();
writer.close().unwrap();

let mut reader = ParquetFileArrowReader::try_new(Bytes::from(buffer)).unwrap();
let mut reader = reader.get_record_reader(1024).unwrap();
let read = reader.next().unwrap().unwrap();

assert_eq!(to_write, read);

Implementations

Try to create a new Arrow writer

The writer will fail if:

  • a SerializedFileWriter cannot be created from the ParquetWriter
  • the Arrow schema contains unsupported datatypes such as Unions

Returns metadata for any flushed row groups

Enqueues the provided RecordBatch to be written

If following this there are more than max_row_group_size rows buffered, this will flush out one or more row groups with max_row_group_size rows, and drop any fully written RecordBatch

Flushes all buffered rows into a new row group

Close and finalize the underlying Parquet writer

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.