Parquet Derive
A crate for deriving RecordWriter and RecordReader for arbitrary, simple structs. This does not
generate readers or writers for arbitrarily nested structures. It only works for primitives and a few
generic structures and various levels of reference. Please see features checklist for what is currently
supported.
Derive also has some support for the chrono time library. You must must enable the chrono feature to get this support.
Usage
See example in ParquetRecordWriter for reading/writing to a parquet file.
Add this to your Cargo.toml:
[]
= "39.0.0"
= "39.0.0"
and this to your crate root:
extern crate parquet;
extern crate parquet_derive;
Example usage of deriving a RecordWriter for your struct:
use parquet;
use RecordWriter;
// Initialize your parquet file
let mut writer = new.unwrap;
let mut row_group = writer.next_row_group.unwrap;
// Build up your records
let chunks = vec!;
// The derived `RecordWriter` takes over here
.write_to_row_group;
writer.close_row_group.unwrap;
writer.close.unwrap;
Example usage of deriving a RecordReader for your struct:
use ;
use ParquetRecordReader;
// Initialize your parquet file
let reader = new.unwrap;
let mut row_group = reader.get_row_group.unwrap;
// create your records vector to read into
let mut chunks: = Vecnew;
// The derived `RecordReader` takes over here
chunks.read_from_row_group.unwrap;
Features
-
Support writing
String,&str,bool,i32,f32,f64,Vec<u8> -
Support writing dictionaries
-
Support writing logical types like timestamp
-
Derive definition_levels for
Optionfor writing -
Derive definition levels for nested structures for writing
-
Derive writing tuple struct
-
Derive writing
tuplecontainer types -
Support reading
String,&str,bool,i32,f32,f64,Vec<u8> -
Support reading/writing dictionaries
-
Support reading/writing logical types like timestamp
-
Handle definition_levels for
Optionfor reading -
Handle definition levels for nested structures for reading
-
Derive reading/writing tuple struct
-
Derive reading/writing
tuplecontainer types
Requirements
- Same as
parquet-rs
Test
Testing a *_derive crate requires an intermediate crate. Go to parquet_derive_test and run cargo test for
unit tests.
To compile and test doctests, run cargo test --doc -- --show-output
Docs
To build documentation, run cargo doc --no-deps.
To compile and view in the browser, run cargo doc --no-deps --open.
License
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0.