|
18 | 18 | use crate::arrow::arrow_reader::{ |
19 | 19 | ArrowReaderMetadata, ArrowReaderOptions, ParquetRecordBatchReaderBuilder, |
20 | 20 | }; |
| 21 | +use crate::arrow::ArrowWriter; |
21 | 22 | use crate::encryption::decryption::FileDecryptionProperties; |
| 23 | +use crate::encryption::encrypt::FileEncryptionProperties; |
| 24 | +use crate::file::properties::WriterProperties; |
22 | 25 | use arrow_array::cast::AsArray; |
23 | 26 | use arrow_array::{types, RecordBatch}; |
24 | 27 | use std::fs::File; |
25 | | -use crate::arrow::ArrowWriter; |
26 | | -use crate::encryption::encrypt::FileEncryptionProperties; |
27 | | -use crate::file::properties::WriterProperties; |
28 | 28 |
|
29 | 29 | /// Tests reading an encrypted file from the parquet-testing repository |
30 | 30 | pub fn verify_encryption_test_file_read( |
@@ -102,18 +102,24 @@ pub fn verify_encryption_test_file_read( |
102 | 102 | } |
103 | 103 |
|
104 | 104 | #[cfg(feature = "encryption")] |
105 | | -pub fn read_and_roundtrip_to_encrypted_file(path: &str, decryption_properties: FileDecryptionProperties, encryption_properties: FileEncryptionProperties) { |
| 105 | +pub fn read_and_roundtrip_to_encrypted_file( |
| 106 | + path: &str, |
| 107 | + decryption_properties: FileDecryptionProperties, |
| 108 | + encryption_properties: FileEncryptionProperties, |
| 109 | +) { |
106 | 110 | let temp_file = tempfile::tempfile().unwrap(); |
107 | 111 |
|
108 | 112 | // read example data |
109 | 113 | let file = File::open(path).unwrap(); |
110 | | - let options = |
111 | | - ArrowReaderOptions::default().with_file_decryption_properties(decryption_properties.clone()); |
| 114 | + let options = ArrowReaderOptions::default() |
| 115 | + .with_file_decryption_properties(decryption_properties.clone()); |
112 | 116 | let metadata = ArrowReaderMetadata::load(&file, options.clone()).unwrap(); |
113 | 117 |
|
114 | 118 | let builder = ParquetRecordBatchReaderBuilder::try_new_with_options(file, options).unwrap(); |
115 | 119 | let batch_reader = builder.build().unwrap(); |
116 | | - let batches = batch_reader.collect::<crate::errors::Result<Vec<RecordBatch>, _>>().unwrap(); |
| 120 | + let batches = batch_reader |
| 121 | + .collect::<crate::errors::Result<Vec<RecordBatch>, _>>() |
| 122 | + .unwrap(); |
117 | 123 |
|
118 | 124 | // write example data |
119 | 125 | let props = WriterProperties::builder() |
|
0 commit comments