rok commented on code in PR #7283:
URL: https://github.com/apache/arrow-rs/pull/7283#discussion_r1994490275


##########
parquet/src/arrow/mod.rs:
##########
@@ -93,6 +93,96 @@
 //!
 //! println!("Read {} records.", record_batch.num_rows());
 //! ```
+//!
+//! # Example of reading uniformly encrypted parquet file into arrow record 
batch
+//!
+#![cfg_attr(feature = "encryption", doc = "```rust")]
+#![cfg_attr(not(feature = "encryption"), doc = "```ignore")]
+//! # use arrow_array::{Int32Array, ArrayRef};
+//! # use arrow_array::{types, RecordBatch};
+//! # use parquet::arrow::arrow_reader::{
+//! #     ArrowReaderMetadata, ArrowReaderOptions, 
ParquetRecordBatchReaderBuilder,
+//! # };
+//! # use arrow_array::cast::AsArray;
+//! # use parquet::file::metadata::ParquetMetaData;
+//! # use tempfile::tempfile;
+//! # use std::fs::File;
+//! # use parquet::encryption::decrypt::FileDecryptionProperties;
+//! # let test_data = arrow::util::test_util::parquet_test_data();
+//! # let path = format!("{test_data}/uniform_encryption.parquet.encrypted");
+//! #
+//!  let file = File::open(path).unwrap();
+//!
+//!  let key_code: &[u8] = "0123456789012345".as_bytes();
+//!  let decryption_properties = 
FileDecryptionProperties::builder(key_code.to_vec())
+//!      .build()
+//!      .unwrap();
+//!
+//! let options =
+//!         
ArrowReaderOptions::default().with_file_decryption_properties(decryption_properties);
+//! let reader_metadata = ArrowReaderMetadata::load(&file, 
options.clone()).unwrap();
+//! let metadata = reader_metadata.metadata();
+//! let file_metadata = metadata.file_metadata();
+//!
+//! println!("Read {} rows.", file_metadata.num_rows());
+//!
+//! let builder = ParquetRecordBatchReaderBuilder::try_new_with_options(file, 
options).unwrap();
+//! println!("Converted arrow schema is: {}", builder.schema());
+//!
+//! let mut reader = builder.build().unwrap();
+//!
+//! let record_batch = reader.next().unwrap().unwrap();
+//!
+//! println!("Read {} records.", record_batch.num_rows());
+//! ```
+//!
+//! # Example of reading non-uniformly encrypted parquet file into arrow 
record batch

Review Comment:
   Removed the uniform example.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to