16 releases (2 stable)

1.0.1 Aug 21, 2020
1.0.0 Jul 24, 2020
0.17.0 Apr 21, 2020
0.16.0 Feb 7, 2020
0.3.0 May 5, 2018

#8 in Database interfaces

Download history 270/week @ 2020-05-29 135/week @ 2020-06-05 201/week @ 2020-06-12 648/week @ 2020-06-19 432/week @ 2020-06-26 336/week @ 2020-07-03 661/week @ 2020-07-10 618/week @ 2020-07-17 1088/week @ 2020-07-24 1351/week @ 2020-07-31 1340/week @ 2020-08-07 1228/week @ 2020-08-14 1353/week @ 2020-08-21 1377/week @ 2020-08-28 1284/week @ 2020-09-04 1241/week @ 2020-09-11

2,864 downloads per month
Used in 8 crates (5 directly)

Apache-2.0

2.5MB
56K SLoC

An Apache Parquet implementation in Rust

Usage

Add this to your Cargo.toml:

[dependencies]
parquet = "1.0.1"

and this to your crate root:

extern crate parquet;

Example usage of reading data:

use std::fs::File;
use std::path::Path;
use parquet::file::reader::{FileReader, SerializedFileReader};

let file = File::open(&Path::new("/path/to/file")).unwrap();
let reader = SerializedFileReader::new(file).unwrap();
let mut iter = reader.get_row_iter(None).unwrap();
while let Some(record) = iter.next() {
    println!("{}", record);
}

See crate documentation on available API.

Supported Parquet Version

  • Parquet-format 2.4.0

To update Parquet format to a newer version, check if parquet-format version is available. Then simply update version of parquet-format crate in Cargo.toml.

Features

  • All encodings supported
  • All compression codecs supported
  • Read support
    • Primitive column value readers
    • Row record reader
    • Arrow record reader
  • Statistics support
  • Write support
    • Primitive column value writers
    • Row record writer
    • Arrow record writer
  • Predicate pushdown
  • Parquet format 2.5 support

Requirements

  • Rust nightly

See Working with nightly Rust to install nightly toolchain and set it as default.

Parquet requires LLVM. Our windows CI image includes LLVM but to build the libraries locally windows users will have to install LLVM. Follow this link for info.

Build

Run cargo build or cargo build --release to build in release mode. Some features take advantage of SSE4.2 instructions, which can be enabled by adding RUSTFLAGS="-C target-feature=+sse4.2" before the cargo build command.

Test

Run cargo test for unit tests.

Binaries

The following binaries are provided (use cargo install to install them):

  • parquet-schema for printing Parquet file schema and metadata. Usage: parquet-schema <file-path> [verbose], where file-path is the path to a Parquet file, and optional verbose is the boolean flag that allows to print full metadata or schema only (when not specified only schema will be printed).

  • parquet-read for reading records from a Parquet file. Usage: parquet-read <file-path> [num-records], where file-path is the path to a Parquet file, and num-records is the number of records to read from a file (when not specified all records will be printed).

  • parquet-rowcount for reporting the number of records in one or more Parquet files. Usage: parquet-rowcount <file-path> ..., where file-path is the path to a Parquet file, and ... indicates any number of additional parquet files.

If you see Library not loaded error, please make sure LD_LIBRARY_PATH is set properly:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(rustc --print sysroot)/lib

Benchmarks

Run cargo bench for benchmarks.

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.

Dependencies

~20MB
~417K SLoC