Created
April 4, 2024 23:48
-
-
Save maltzsama/3615922f75089f57519602e5c1e54451 to your computer and use it in GitHub Desktop.
leitor de parquet usando rust
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fs::File; | |
use parquet::arrow::arrow_reader::ParquetRecordBatchReaderBuilder; | |
fn main(){ | |
let file_path = "Flights_1m.parquet"; | |
let file = File::open(file_path).unwrap(); | |
// let builder = ParquetRecordBatchReaderBuilder::try_new(file).unwrap(); | |
let builder = ParquetRecordBatchReaderBuilder::try_new(file).unwrap(); | |
println!("Converted arrow schema is: {}", builder.schema()); | |
let mut reader = builder.build().unwrap(); | |
while let Some(Ok(record_batch)) = reader.next() { | |
for i in 0..record_batch.num_columns() { | |
let column = record_batch.column(i); | |
println!("Column {}: {:?}", i, column); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment