49 releases (32 major breaking)

35.0.0 Mar 13, 2023
34.0.0 Feb 27, 2023
33.0.0 Feb 13, 2023
32.0.0 Jan 30, 2023
3.0.0 Jan 26, 2021

#882 in Procedural macros

Download history 64/week @ 2022-12-01 108/week @ 2022-12-08 103/week @ 2022-12-15 116/week @ 2022-12-22 70/week @ 2022-12-29 110/week @ 2023-01-05 121/week @ 2023-01-12 119/week @ 2023-01-19 304/week @ 2023-01-26 135/week @ 2023-02-02 373/week @ 2023-02-09 289/week @ 2023-02-16 216/week @ 2023-02-23 141/week @ 2023-03-02 234/week @ 2023-03-09 164/week @ 2023-03-16

829 downloads per month
Used in gosh-dataset


48K SLoC

Parquet Derive

A crate for deriving RecordWriter for arbitrary, simple structs. This does not generate 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.


Add this to your Cargo.toml:

parquet = "35.0.0"
parquet_derive = "35.0.0"

and this to your crate root:

extern crate parquet;
#[macro_use] extern crate parquet_derive;

Example usage of deriving a RecordWriter for your struct:

use parquet;
use parquet::record::RecordWriter;

struct ACompleteRecord<'a> {
    pub a_bool: bool,
    pub a_str: &'a str,
    pub a_string: String,
    pub a_borrowed_string: &'a String,
    pub maybe_a_str: Option<&'a str>,
    pub magic_number: i32,
    pub low_quality_pi: f32,
    pub high_quality_pi: f64,
    pub maybe_pi: Option<f32>,
    pub maybe_best_pi: Option<f64>,

// Initialize your parquet file
let mut writer = SerializedFileWriter::new(file, schema, props).unwrap();
let mut row_group = writer.next_row_group().unwrap();

// Build up your records
let chunks = vec![ACompleteRecord{...}];

// The derived `RecordWriter` takes over here
(&chunks[..]).write_to_row_group(&mut row_group);



  • Support writing String, &str, bool, i32, f32, f64, Vec<u8>
  • Support writing dictionaries
  • Support writing logical types like timestamp
  • Derive definition_levels for Option
  • Derive definition levels for nested structures
  • Derive writing tuple struct
  • Derive writing tuple container types


  • Same as parquet-rs


Testing a *_derive crate requires an intermediate crate. Go to parquet_derive_test and run cargo test for unit tests.


To build documentation, run cargo doc --no-deps. To compile and view in the browser, run cargo doc --no-deps --open.


Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0.


~81K SLoC