From 6b19cd283661cbcd1e2972f23676508c70863bd4 Mon Sep 17 00:00:00 2001 From: Ivan Date: Sat, 31 Mar 2018 19:36:40 +1300 Subject: [PATCH] Update binaries and readme (#69) --- README.md | 12 ++++++++++++ src/bin/parquet-read.rs | 2 +- src/bin/parquet-schema.rs | 4 ++-- src/schema/printer.rs | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 60eb57e..ff789a9 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,18 @@ Run `cargo build` or `cargo build --release` to build in release mode. ## 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 [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 [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). + ## Benchmarks Run `cargo bench` for benchmarks. diff --git a/src/bin/parquet-read.rs b/src/bin/parquet-read.rs index 4792746..bf015c6 100644 --- a/src/bin/parquet-read.rs +++ b/src/bin/parquet-read.rs @@ -10,7 +10,7 @@ use parquet::file::reader::{FileReader, SerializedFileReader}; fn main() { let args: Vec = env::args().collect(); if args.len() != 2 && args.len() != 3 { - println!("Usage: read-file [num-records]"); + println!("Usage: parquet-read [num-records]"); process::exit(1); } diff --git a/src/bin/parquet-schema.rs b/src/bin/parquet-schema.rs index db73eed..4413174 100644 --- a/src/bin/parquet-schema.rs +++ b/src/bin/parquet-schema.rs @@ -28,7 +28,7 @@ use parquet::schema::printer::{print_parquet_metadata, print_file_metadata}; fn main() { let args: Vec = env::args().collect(); if args.len() != 2 && args.len() != 3 { - println!("Usage: dump-schema "); + println!("Usage: parquet-schema [verbose]"); process::exit(1); } let path = Path::new(&args[1]); @@ -36,7 +36,7 @@ fn main() { if args.len() == 3 { match args[2].parse() { Ok(b) => verbose = b, - Err(e) => panic!("Error when reading value for \ + Err(e) => panic!("Error when reading value for [verbose] \ (expected either 'true' or 'false'): {}", e) } } diff --git a/src/schema/printer.rs b/src/schema/printer.rs index 54916f1..0ee893a 100644 --- a/src/schema/printer.rs +++ b/src/schema/printer.rs @@ -59,7 +59,7 @@ pub fn print_schema(out: &mut io::Write, tp: &Type) { let mut printer = Printer::new(&mut s); printer.print(tp); } - write!(out, "{}", s); + writeln!(out, "{}", s); } #[allow(unused_must_use)]