-
Notifications
You must be signed in to change notification settings - Fork 824
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
Deprecate methods from footer.rs in favor of ParquetMetaDataReader
#6451
Conversation
} | ||
|
||
#[cfg(test)] | ||
mod tests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are all replicated in parquet/src/file/metadata/reader.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @etseidl -- I think the code in this PR looks great.
Also, I know it was more work, but breaking them up into multiple PRs has made reviewing it much easier (though I admit it is still taking pretty long)
@@ -382,7 +381,7 @@ impl ArrowReaderMetadata { | |||
/// `Self::metadata` is missing the page index, this function will attempt | |||
/// to load the page index by making an object store request. | |||
pub fn load<T: ChunkReader>(reader: &T, options: ArrowReaderOptions) -> Result<Self> { | |||
let mut metadata = footer::parse_metadata(reader)?; | |||
let mut metadata = ParquetMetaDataReader::new().parse_and_finish(reader)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So beautiful 👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There will be a small conflict here with #6450. I couldn't use the new API for the page indexes until the behavior change was dealt with.
@@ -51,34 +42,9 @@ use crate::schema::types::{self, SchemaDescriptor}; | |||
/// # See Also | |||
/// [`decode_metadata`] for decoding the metadata from the bytes. | |||
/// [`decode_footer`] for decoding the metadata length from the footer. | |||
#[deprecated(since = "53.1.0", note = "Use ParquetMetaDataReader")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
use crate::schema::types::Type as SchemaType; | ||
|
||
#[test] | ||
fn test_parse_metadata_size_smaller_than_footer() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I verified that these tests have already been ported to the reader module:
arrow-rs/parquet/src/file/metadata/reader.rs
Lines 639 to 654 in 6137e91
fn test_parse_metadata_size_smaller_than_footer() { | |
let test_file = tempfile::tempfile().unwrap(); | |
let err = ParquetMetaDataReader::parse_metadata(&test_file).unwrap_err(); | |
assert!(matches!(err, ParquetError::IndexOutOfBound(8, _))); | |
} | |
#[test] | |
fn test_parse_metadata_corrupt_footer() { | |
let data = Bytes::from(vec![1, 2, 3, 4, 5, 6, 7, 8]); | |
let reader_result = ParquetMetaDataReader::parse_metadata(&data); | |
assert_eq!( | |
reader_result.unwrap_err().to_string(), | |
"Parquet error: Invalid Parquet file. Corrupt footer" | |
); | |
} | |
Yes, #6392 was monstrous (and reviewing this had to be tedious). I'll do what I can to lighten your load as we move forward. |
Looking very nice -- thanks @etseidl |
Which issue does this PR close?
Part of #6447
Rationale for this change
See issue
What changes are included in this PR?
Add deprecation warnings to public methods in footer.rs (
parse_metadata
,decode_metadata
,decode_footer
) and replace usages with equivalent functions fromParquetMetaDataReader
.Are there any user-facing changes?
No