|
18 | 18 | use crate::arrow::arrow_reader::{
|
19 | 19 | ArrowReaderMetadata, ArrowReaderOptions, ParquetRecordBatchReaderBuilder,
|
20 | 20 | };
|
21 |
| -use crate::arrow::ParquetRecordBatchStreamBuilder; |
22 |
| -use crate::encryption::decrypt::FileDecryptionProperties; |
23 |
| -use crate::errors::ParquetError; |
24 |
| -use crate::file::metadata::FileMetaData; |
25 | 21 | use arrow_array::cast::AsArray;
|
26 | 22 | use arrow_array::{types, RecordBatch};
|
27 |
| -use futures::TryStreamExt; |
| 23 | + |
28 | 24 | use std::fs::File;
|
29 | 25 | use crate::arrow::ArrowWriter;
|
30 | 26 | use crate::encryption::encrypt::FileEncryptionProperties;
|
| 27 | +use crate::encryption::decrypt::FileDecryptionProperties; |
31 | 28 | use crate::file::properties::WriterProperties;
|
32 | 29 |
|
33 | 30 | /// Tests reading an encrypted file from the parquet-testing repository
|
@@ -139,18 +136,24 @@ fn verify_encryption_test_data(
|
139 | 136 | }
|
140 | 137 |
|
141 | 138 | #[cfg(feature = "encryption")]
|
142 |
| -pub fn read_and_roundtrip_to_encrypted_file(path: &str, decryption_properties: FileDecryptionProperties, encryption_properties: FileEncryptionProperties) { |
| 139 | +pub fn read_and_roundtrip_to_encrypted_file( |
| 140 | + path: &str, |
| 141 | + decryption_properties: FileDecryptionProperties, |
| 142 | + encryption_properties: FileEncryptionProperties, |
| 143 | +) { |
143 | 144 | let temp_file = tempfile::tempfile().unwrap();
|
144 | 145 |
|
145 | 146 | // read example data
|
146 | 147 | let file = File::open(path).unwrap();
|
147 |
| - let options = |
148 |
| - ArrowReaderOptions::default().with_file_decryption_properties(decryption_properties.clone()); |
| 148 | + let options = ArrowReaderOptions::default() |
| 149 | + .with_file_decryption_properties(decryption_properties.clone()); |
149 | 150 | let metadata = ArrowReaderMetadata::load(&file, options.clone()).unwrap();
|
150 | 151 |
|
151 | 152 | let builder = ParquetRecordBatchReaderBuilder::try_new_with_options(file, options).unwrap();
|
152 | 153 | let batch_reader = builder.build().unwrap();
|
153 |
| - let batches = batch_reader.collect::<crate::errors::Result<Vec<RecordBatch>, _>>().unwrap(); |
| 154 | + let batches = batch_reader |
| 155 | + .collect::<crate::errors::Result<Vec<RecordBatch>, _>>() |
| 156 | + .unwrap(); |
154 | 157 |
|
155 | 158 | // write example data
|
156 | 159 | let props = WriterProperties::builder()
|
|
0 commit comments