Skip to main content

ParquetObjectWriter

Struct ParquetObjectWriter 

Source
pub struct ParquetObjectWriter {
    w: BufWriter,
}
๐Ÿ‘ŽDeprecated since 59.2.0:

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: BufWriter
๐Ÿ‘ŽDeprecated since 59.2.0:

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.

Implementationsยง

Sourceยง

impl ParquetObjectWriter

Source

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

Source

pub fn from_buf_writer(w: BufWriter) -> Self

Construct a new ParquetObjectWriter via a existing BufWriter.

Source

pub fn into_inner(self) -> BufWriter

Consume the writer and return the underlying BufWriter.

Trait Implementationsยง

Sourceยง

impl AsyncFileWriter for ParquetObjectWriter

Sourceยง

fn write(&mut self, bs: Bytes) -> BoxFuture<'_, Result<()>>

Write the provided bytes to the underlying writer Read more
Sourceยง

fn complete(&mut self) -> BoxFuture<'_, Result<()>>

Flush any buffered data to the underlying writer and finish writing process. Read more
Sourceยง

impl Debug for ParquetObjectWriter

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl From<BufWriter> for ParquetObjectWriter

Sourceยง

fn from(w: BufWriter) -> Self

Converts to this type from the input type.

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
ยง

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

ยง

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

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

ยง

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
ยง

impl<T> Ungil for T
where T: Send,