pub struct ParquetObjectWriter {
w: BufWriter,
}Pass an object_store::buffered::BufWriter to AsyncArrowWriter directly instead; see https://github.com/apache/arrow-rs/issues/10308 and parquet/examples/object_store.rs.
Expand description
ParquetObjectWriter for writing to parquet to [ObjectStore]
This type is deprecated: [BufWriter] implements AsyncWrite and can
therefore be passed to AsyncArrowWriter directly via the blanket
AsyncFileWriter implementation for AsyncWrite types:
let store = Arc::new(InMemory::new());
let col = Arc::new(Int64Array::from_iter_values([1, 2, 3])) as ArrayRef;
let to_write = RecordBatch::try_from_iter([("col", col)]).unwrap();
let object_store_writer = BufWriter::new(store.clone(), Path::from("test"));
let mut writer =
AsyncArrowWriter::try_new(object_store_writer, to_write.schema(), None).unwrap();
writer.write(&to_write).await.unwrap();
writer.close().await.unwrap();
let buffer = store
.get(&Path::from("test"))
.await
.unwrap()
.bytes()
.await
.unwrap();
let mut reader = ParquetRecordBatchReaderBuilder::try_new(buffer)
.unwrap()
.build()
.unwrap();
let read = reader.next().unwrap().unwrap();
assert_eq!(to_write, read);Fieldsยง
ยงw: BufWriterPass an object_store::buffered::BufWriter to AsyncArrowWriter directly instead; see https://github.com/apache/arrow-rs/issues/10308 and parquet/examples/object_store.rs.
Implementationsยง
Sourceยงimpl ParquetObjectWriter
impl ParquetObjectWriter
Sourcepub fn new(store: Arc<dyn ObjectStore>, path: Path) -> Self
pub fn new(store: Arc<dyn ObjectStore>, path: Path) -> Self
Create a new ParquetObjectWriter that writes to the specified path in the given store.
To configure the writer behavior, please build [BufWriter] and then use Self::from_buf_writer
Sourcepub fn from_buf_writer(w: BufWriter) -> Self
pub fn from_buf_writer(w: BufWriter) -> Self
Construct a new ParquetObjectWriter via a existing BufWriter.
Sourcepub fn into_inner(self) -> BufWriter
pub fn into_inner(self) -> BufWriter
Consume the writer and return the underlying BufWriter.