Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rok committed Nov 23, 2024
1 parent 6f055f9 commit fe488b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 10 additions & 1 deletion parquet/src/arrow/arrow_reader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ impl<T: ChunkReader + 'static> ParquetRecordBatchReaderBuilder<T> {
Ok(Self::new_with_metadata(reader, metadata))
}

// Create a new [`ParquetRecordBatchReaderBuilder`] with [`ArrowReaderOptions`] and [`FileDecryptionProperties`]
pub fn try_new_with_decryption(
reader: T,
options: ArrowReaderOptions,
Expand Down Expand Up @@ -569,6 +570,8 @@ impl<T: ChunkReader + 'static> ParquetRecordBatchReaderBuilder<T> {
/// # use arrow_schema::{DataType, Field, Schema};
/// # use parquet::arrow::arrow_reader::{ArrowReaderMetadata, ParquetRecordBatchReader, ParquetRecordBatchReaderBuilder};
/// # use parquet::arrow::ArrowWriter;
/// # use crate::parquet::encryption::ciphers::FileDecryptionProperties;
/// #
/// # let mut file: Vec<u8> = Vec::with_capacity(1024);
/// # let schema = Arc::new(Schema::new(vec![Field::new("i32", DataType::Int32, false)]));
/// # let mut writer = ArrowWriter::try_new(&mut file, schema.clone(), None).unwrap();
Expand All @@ -577,7 +580,13 @@ impl<T: ChunkReader + 'static> ParquetRecordBatchReaderBuilder<T> {
/// # writer.close().unwrap();
/// # let file = Bytes::from(file);
/// #
/// let metadata = ArrowReaderMetadata::load(&file, Default::default()).unwrap();
/// # let key_code: &[u8] = "0123456789012345".as_bytes();
/// let decryption_properties = Some(
/// FileDecryptionProperties::builder()
/// .with_footer_key(key_code.to_vec())
/// .build(),
/// );
/// let metadata = ArrowReaderMetadata::load(&file, Default::default(), decryption_properties).unwrap();
/// let mut a = ParquetRecordBatchReaderBuilder::new_with_metadata(file.clone(), metadata.clone()).build().unwrap();
/// let mut b = ParquetRecordBatchReaderBuilder::new_with_metadata(file, metadata).build().unwrap();
///
Expand Down
6 changes: 4 additions & 2 deletions parquet/src/arrow/async_reader/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@ impl<F: MetadataFetch> MetadataLoader<F> {
let (metadata, remainder) = if length > suffix_len - FOOTER_SIZE {
let metadata_start = file_size - length - FOOTER_SIZE;
let meta = fetch.fetch(metadata_start..file_size - FOOTER_SIZE).await?;
(ParquetMetaDataReader::decode_metadata(&meta)?, None)
// TODO: this won't decrypt
(ParquetMetaDataReader::decode_metadata(&meta, None)?, None)
} else {
let metadata_start = file_size - length - FOOTER_SIZE - footer_start;

let slice = &suffix[metadata_start..suffix_len - FOOTER_SIZE];
(
ParquetMetaDataReader::decode_metadata(slice)?,
// TODO: this won't decrypt
ParquetMetaDataReader::decode_metadata(slice, None)?,
Some((footer_start, suffix.slice(..metadata_start))),
)
};
Expand Down

0 comments on commit fe488b3

Please sign in to comment.