Expand description
async API for writing [RecordBatch]es to Parquet files
See the crate-level documentation for more details.
The async API for writing [RecordBatch]es is
similar to the sync API, so please
read the documentation there before using this API.
Here is an example for using AsyncArrowWriter:
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 = AsyncArrowWriter::try_new(&mut buffer, to_write.schema(), None).unwrap();
writer.write(&to_write).await.unwrap();
writer.close().await.unwrap();
let buffer = Bytes::from(buffer);
let mut reader = ParquetRecordBatchReaderBuilder::try_new(buffer.clone())
.unwrap()
.build()
.unwrap();
let read = reader.next().unwrap().unwrap();
assert_eq!(to_write, read);There is a blanket implementation of AsyncFileWriter for all types that
implement [AsyncWrite], so writers such as tokio::fs::File, or
object_store::buffered::BufWriter for writing to object storage, can be
passed to AsyncArrowWriter directly.
Re-exportsยง
use crate::arrow::ArrowWriter;๐use crate::arrow::arrow_writer::ArrowWriterOptions;๐use crate::errors::ParquetError;๐use crate::errors::Result;๐use crate::file::metadata::KeyValue;๐use crate::file::metadata::ParquetMetaData;๐use crate::file::metadata::RowGroupMetaData;๐use crate::file::properties::WriterProperties;๐use arrow_array::RecordBatch;๐use arrow_schema::SchemaRef;๐use bytes::Bytes;๐use futures::FutureExt;๐use futures::future::BoxFuture;๐use std::mem;๐use tokio::io::AsyncWrite;๐use tokio::io::AsyncWriteExt;๐
Modulesยง
- store ๐
Structsยง
- Async
Arrow Writer - Encodes [
RecordBatch] to parquet, outputting to anAsyncFileWriter - Parquet
Object Writer Deprecated ParquetObjectWriterfor writing to parquet to [ObjectStore]
Traitsยง
- Async
File Writer - The asynchronous interface used by
AsyncArrowWriterto write parquet files.