Derive Macro parquet_derive::ParquetRecordReader
source · #[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 in the order they are defined.
It is up to the programmer to keep the order of the struct fields lined up with the schema.
Example:
ⓘ
use parquet::file::{serialized_reader::SerializedFileReader, reader::FileReader};
use parquet_derive::{ParquetRecordReader};
#[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 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
}