This repository has been archived by the owner on Jan 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
2,227 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
extern crate parquet; | ||
|
||
use std::env; | ||
use std::fs::File; | ||
use std::path::Path; | ||
use std::process; | ||
|
||
use parquet::file::reader::{FileReader, SerializedFileReader}; | ||
|
||
fn main() { | ||
let args: Vec<String> = env::args().collect(); | ||
if args.len() != 2 && args.len() != 3 { | ||
println!("Usage: read-file <file-path> [num-records]"); | ||
process::exit(1); | ||
} | ||
|
||
let mut num_records: Option<usize> = None; | ||
if args.len() == 3 { | ||
match args[2].parse() { | ||
Ok(value) => num_records = Some(value), | ||
Err(e) => panic!("Error when reading value for [num-records], {}", e) | ||
} | ||
} | ||
|
||
let path = Path::new(&args[1]); | ||
let file = File::open(&path).unwrap(); | ||
let parquet_reader = SerializedFileReader::new(file).unwrap(); | ||
|
||
// Use full schema as projected schema | ||
let mut iter = parquet_reader.get_row_iter(None).unwrap(); | ||
|
||
let mut start = 0; | ||
let end = num_records.unwrap_or(0); | ||
let all_records = num_records.is_none(); | ||
|
||
while all_records || start < end { | ||
match iter.next() { | ||
Some(row) => println!("{}", row), | ||
None => break, | ||
} | ||
start += 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.