How to Read Parquet Files in Rust

Read Parquet files in Rust by adding the `parquet` and `arrow` crates and using `ParquetRecordBatchReaderBuilder` to stream data.

Use the parquet crate with the arrow ecosystem to read Parquet files in Rust. Add the dependencies to your Cargo.toml and use ParquetRecordBatchReaderBuilder to stream the data into Arrow batches.

[dependencies]
parquet = "51"
arrow = "51"
use std::fs::File;
use parquet::arrow::ParquetRecordBatchReaderBuilder;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let file = File::open("data.parquet")?;
    let builder = ParquetRecordBatchReaderBuilder::try_new(file)?;
    let mut reader = builder.build()?;
    
    while let Some(batch_result) = reader.next() {
        let batch = batch_result?;
        println!("Read {} rows", batch.num_rows());
    }
    Ok(())
}