#[derive(ParquetRecordReader)]
Expand description
Derive flat, simple RecordReader implementations.
Works by parsing a struct tagged with #[derive(ParquetRecordReader)]
and emitting
the correct writing code for each field of the struct. Column readers
are generated by matching names in the schema to the names in the struct.
It is up to the programmer to ensure the names in the struct fields line up with the schema.
Example:
use parquet::record::RecordReader;
use parquet::file::{serialized_reader::SerializedFileReader, reader::FileReader};
use parquet_derive::{ParquetRecordReader};
use std::fs::File;
#[derive(ParquetRecordReader)]
struct ACompleteRecord {
pub a_bool: bool,
pub a_string: String,
}
pub fn read_some_records() -> Vec<ACompleteRecord> {
let mut samples: Vec<ACompleteRecord> = Vec::new();
let file = File::open("some_file.parquet").unwrap();
let reader = SerializedFileReader::new(file).unwrap();
let mut row_group = reader.get_row_group(0).unwrap();
samples.read_from_row_group(&mut *row_group, 1).unwrap();
samples
}