Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify ParquetFileArrowReader Metadata API #1773

Merged
merged 1 commit into from
Jun 1, 2022
Merged
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
12 changes: 12 additions & 0 deletions parquet/src/arrow/arrow_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use crate::arrow::ProjectionMask;
use crate::errors::Result;
use crate::file::metadata::{KeyValue, ParquetMetaData};
use crate::file::reader::FileReader;
use crate::schema::types::SchemaDescriptor;

/// Arrow reader api.
/// With this api, user can get arrow schema from parquet file, and read parquet data
Expand Down Expand Up @@ -164,10 +165,21 @@ impl ParquetFileArrowReader {
}

/// Expose the reader metadata
#[deprecated = "use metadata() instead"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 love deprecated -- first step towards keeping the API stable for longer 👍

pub fn get_metadata(&mut self) -> ParquetMetaData {
self.file_reader.metadata().clone()
}

/// Returns the parquet metadata
pub fn metadata(&self) -> &ParquetMetaData {
self.file_reader.metadata()
}

/// Returns the parquet schema
pub fn parquet_schema(&self) -> &SchemaDescriptor {
self.file_reader.metadata().file_metadata().schema_descr()
}

/// Returns the key value metadata, returns `None` if [`ArrowReaderOptions::skip_arrow_metadata`]
fn get_kv_metadata(&self) -> Option<&Vec<KeyValue>> {
if self.options.skip_arrow_metadata {
Expand Down