Skip to content

Commit f54828b

Browse files
committed
Remove uniform encryption example, better comments
1 parent d2024bb commit f54828b

File tree

1 file changed

+5
-47
lines changed

1 file changed

+5
-47
lines changed

parquet/src/arrow/mod.rs

+5-47
Original file line numberDiff line numberDiff line change
@@ -95,51 +95,6 @@
9595
//! ```
9696
//!
9797
//! #![cfg(feature = "encryption")]
98-
//! # Example of reading uniformly encrypted parquet file into arrow record batch
99-
//!
100-
#![cfg(feature = "encryption")]
101-
//! ```rust
102-
#![cfg(not(feature = "encryption"))]
103-
//! ```ignore
104-
//! # use arrow_array::{Int32Array, ArrayRef};
105-
//! # use arrow_array::{types, RecordBatch};
106-
//! # use parquet::arrow::arrow_reader::{
107-
//! # ArrowReaderMetadata, ArrowReaderOptions, ParquetRecordBatchReaderBuilder,
108-
//! # };
109-
//! # use arrow_array::cast::AsArray;
110-
//! # use parquet::file::metadata::ParquetMetaData;
111-
//! # use tempfile::tempfile;
112-
//! # use std::fs::File;
113-
//! # use parquet::encryption::decrypt::FileDecryptionProperties;
114-
//! # let test_data = arrow::util::test_util::parquet_test_data();
115-
//! # let path = format!("{test_data}/uniform_encryption.parquet.encrypted");
116-
//! #
117-
//! let file = File::open(path).unwrap();
118-
//!
119-
//! let key_code: &[u8] = "0123456789012345".as_bytes();
120-
//! let decryption_properties = FileDecryptionProperties::builder(key_code.to_vec())
121-
//! .build()
122-
//! .unwrap();
123-
//!
124-
//! let options =
125-
//! ArrowReaderOptions::default().with_file_decryption_properties(decryption_properties);
126-
//! let reader_metadata = ArrowReaderMetadata::load(&file, options.clone()).unwrap();
127-
//! let metadata = reader_metadata.metadata();
128-
//! let file_metadata = metadata.file_metadata();
129-
//!
130-
//! println!("Read {} rows.", file_metadata.num_rows());
131-
//!
132-
//! let builder = ParquetRecordBatchReaderBuilder::try_new_with_options(file, options).unwrap();
133-
//! println!("Converted arrow schema is: {}", builder.schema());
134-
//!
135-
//! let mut reader = builder.build().unwrap();
136-
//!
137-
//! let record_batch = reader.next().unwrap().unwrap();
138-
//!
139-
//! println!("Read {} records.", record_batch.num_rows());
140-
//! ```
141-
//!
142-
//! #![cfg(feature = "encryption")]
14398
//! # Example of reading non-uniformly encrypted parquet file into arrow record batch
14499
//!
145100
#![cfg(feature = "encryption")]
@@ -161,8 +116,11 @@
161116
//! #
162117
//! let file = File::open(path).unwrap();
163118
//!
164-
//! // There is always a footer key even with a plaintext footer,
165-
//! // but this is used for signing the footer.
119+
//! // Define the AES encryption keys required required for decrypting the footer metadata
120+
//! // and column-specific data. If only a footer key is used then it is assumed that the
121+
//! // file uses uniform encryption and all columns are encrypted with the footer key.
122+
//! // If any column keys are specified, other columns without a key provided are assumed
123+
//! // to be unencrypted
166124
//! let footer_key = "0123456789012345".as_bytes(); // Keys are 128 bits (16 bytes)
167125
//! let column_1_key = "1234567890123450".as_bytes();
168126
//! let column_2_key = "1234567890123451".as_bytes();

0 commit comments

Comments
 (0)