Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Added support to write parquet _metadata sidecar #1063

Merged
merged 1 commit into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/io/parquet/write/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use parquet2::write::WriteOptions as FileWriteOptions;
use crate::datatypes::Schema;
use crate::error::{Error, Result};

use super::{schema::schema_to_metadata_key, to_parquet_schema, WriteOptions};
use super::{schema::schema_to_metadata_key, to_parquet_schema, ThriftFileMetaData, WriteOptions};

/// Attaches [`Schema`] to `key_value_metadata`
pub fn add_arrow_schema(
Expand Down Expand Up @@ -87,4 +87,11 @@ impl<W: Write> FileWriter<W> {
pub fn into_inner(self) -> W {
self.writer.into_inner()
}

/// Returns the underlying writer and [`ThriftFileMetaData`]
/// # Panics
/// This function panics if [`Self::end`] has not yet been called
pub fn into_inner_and_metadata(self) -> (W, ThriftFileMetaData) {
self.writer.into_inner_and_metadata()
}
}
7 changes: 5 additions & 2 deletions src/io/parquet/write/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ pub use parquet2::{
compression::{BrotliLevel, CompressionLevel, CompressionOptions, GzipLevel, ZstdLevel},
encoding::Encoding,
fallible_streaming_iterator,
metadata::{Descriptor, KeyValue, SchemaDescriptor},
metadata::{Descriptor, FileMetaData, KeyValue, SchemaDescriptor, ThriftFileMetaData},
page::{CompressedDataPage, CompressedPage, EncodedPage},
schema::types::{FieldInfo, ParquetType, PhysicalType as ParquetPhysicalType},
write::{compress, Compressor, DynIter, DynStreamingIterator, RowGroupIter, Version},
write::{
compress, write_metadata_sidecar, Compressor, DynIter, DynStreamingIterator, RowGroupIter,
Version,
},
FallibleStreamingIterator,
};

Expand Down