Skip to content

Commit

Permalink
fix parquet test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
alecmocatta committed Sep 8, 2019
1 parent 33ac751 commit 157ee87
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 42 deletions.
1 change: 1 addition & 0 deletions amadeus-parquet/amadeus-parquet-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use syn::{
/// ## Example
///
/// ```text
/// use amadeus_parquet::internal;
/// use internal::record::Record;
///
/// #[derive(Record, Debug)]
Expand Down
10 changes: 2 additions & 8 deletions amadeus-parquet/benches/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,8 @@ pub fn get_test_file(file_name: &str) -> File {
}

fn get_test_path(file_name: &str) -> PathBuf {
let mut pathbuf = match env::var("PARQUET_TEST_DATA") {
Ok(path) => PathBuf::from_str(path.as_str()).unwrap(),
Err(_) => {
let mut pathbuf = env::current_dir().unwrap();
pathbuf.push(PathBuf::from_str("amadeus-testing/data").unwrap());
pathbuf
}
};
let mut pathbuf = env::current_dir().unwrap();
pathbuf.push(PathBuf::from_str("../amadeus-testing/parquet").unwrap());
pathbuf.push(file_name);
pathbuf
}
2 changes: 1 addition & 1 deletion amadeus-parquet/src/internal/column/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
//! ```rust,no_run
//! use std::{fs, path::Path, rc::Rc};
//!
//! use internal::{
//! use amadeus_parquet::internal::{
//! column::{reader::ColumnReader, writer::ColumnWriter},
//! file::{
//! properties::WriterProperties,
Expand Down
2 changes: 1 addition & 1 deletion amadeus-parquet/src/internal/compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//! # Example
//!
//! ```rust
//! use internal::{basic::Compression, compression::create_codec};
//! use amadeus_parquet::internal::{basic::Compression, compression::create_codec};
//!
//! let mut codec = match create_codec(Compression::Snappy) {
//! Ok(Some(codec)) => codec,
Expand Down
6 changes: 3 additions & 3 deletions amadeus-parquet/src/internal/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//! ```rust,no_run
//! use std::{fs, path::Path, rc::Rc};
//!
//! use internal::{
//! use amadeus_parquet::internal::{
//! file::{
//! properties::WriterProperties,
//! writer::{FileWriter, SerializedFileWriter},
Expand Down Expand Up @@ -62,7 +62,7 @@
//! # Example of reading an existing file
//!
//! ```rust,no_run
//! use internal::file::reader::{FileReader, SerializedFileReader, RowGroupReader};
//! use amadeus_parquet::internal::file::reader::{FileReader, SerializedFileReader, RowGroupReader};
//! use std::{fs::File, path::Path};
//!
//! let path = Path::new("/path/to/sample.parquet");
Expand All @@ -80,7 +80,7 @@
//! # Example of reading multiple files
//!
//! ```rust,no_run,ignore
//! use internal::file::reader::SerializedFileReader;
//! use amadeus_parquet::internal::file::reader::SerializedFileReader;
//! use std::convert::TryFrom;
//!
//! let paths = vec![
Expand Down
2 changes: 1 addition & 1 deletion amadeus-parquet/src/internal/file/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//! # Usage
//!
//! ```rust
//! use internal::{
//! use amadeus_parquet::internal::{
//! basic::{Compression, Encoding},
//! file::properties::*,
//! schema::types::ColumnPath,
Expand Down
2 changes: 1 addition & 1 deletion amadeus-parquet/src/internal/file/statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! actual min and max values from statistics, see below:
//!
//! ```rust
//! use internal::file::statistics::Statistics;
//! use amadeus_parquet::internal::file::statistics::Statistics;
//!
//! let stats = Statistics::int32(Some(1), Some(10), None, 3, true);
//! assert_eq!(stats.null_count(), 3);
Expand Down
11 changes: 6 additions & 5 deletions amadeus-parquet/src/internal/record/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
//! ```rust,no_run
//! use std::fs::File;
//! use std::path::Path;
//! use internal::file::reader::{FileReader, SerializedFileReader};
//! use internal::record::types::Row;
//! use amadeus_parquet::internal::file::reader::{FileReader, SerializedFileReader};
//! use amadeus_parquet::internal::record::types::Row;
//!
//! let file = File::open(&Path::new("/path/to/file")).unwrap();
//! let reader = SerializedFileReader::new(file).unwrap();
Expand All @@ -38,8 +38,8 @@
//! ```rust,no_run
//! use std::fs::File;
//! use std::path::Path;
//! use internal::file::reader::{FileReader, SerializedFileReader};
//! use internal::record::{Record, types::Timestamp};
//! use amadeus_parquet::internal::file::reader::{FileReader, SerializedFileReader};
//! use amadeus_parquet::internal::record::{Record, types::Timestamp};
//!
//! #[derive(Record, Debug)]
//! struct MyRow {
Expand Down Expand Up @@ -143,6 +143,7 @@ pub(crate) use self::predicate::Predicate;
/// The easiest way to implement `Record` on a new type is using `#[derive(Record)]`:
///
/// ```
/// use amadeus_parquet::internal;
/// use internal::record::{types::Timestamp, Record};
///
/// #[derive(Record, Debug)]
Expand All @@ -156,7 +157,7 @@ pub(crate) use self::predicate::Predicate;
/// If the Rust field name and the Parquet field name differ, say if the latter is not an idiomatic or valid identifier in Rust, then an automatic rename can be made like so:
///
/// ```
/// # use internal::record::{types::Timestamp, Record};
/// # use amadeus_parquet::internal::record::{types::Timestamp, Record};
/// #[derive(Record, Debug)]
/// struct MyRow {
/// #[parquet(name = "ID")]
Expand Down
7 changes: 4 additions & 3 deletions amadeus-parquet/src/internal/record/schemas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
//! conveniently [`RootSchema`](super::RootSchema) also implements [`Display`].
//!
//! ```
//! # use internal::errors::Result;
//! use internal::record::{RootSchema, types::Value};
//! # use amadeus_parquet::internal::errors::Result;
//! use amadeus_parquet::internal::record::{RootSchema, types::Value};
//!
//! #
//! # fn main() -> Result<()> {
Expand Down Expand Up @@ -1672,7 +1672,8 @@ where
/// schema string like so:
///
/// ```
/// # use internal::errors::Result;
/// # use amadeus_parquet::internal::errors::Result;
/// use amadeus_parquet::internal;
/// use internal::record::{RootSchema, types::Value};
///
/// #
Expand Down
2 changes: 1 addition & 1 deletion amadeus-parquet/src/internal/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//! # Example
//!
//! ```rust
//! use internal::{
//! use amadeus_parquet::internal::{
//! basic::{LogicalType, Repetition, Type as PhysicalType},
//! schema::{parser, printer, types::Type},
//! };
Expand Down
2 changes: 1 addition & 1 deletion amadeus-parquet/src/internal/schema/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//! # Example
//!
//! ```rust
//! use internal::schema::parser::parse_message_type;
//! use amadeus_parquet::internal::schema::parser::parse_message_type;
//!
//! let message_type = "
//! message spark_schema {
Expand Down
2 changes: 1 addition & 1 deletion amadeus-parquet/src/internal/schema/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! # Example
//!
//! ```rust
//! use internal::{
//! use amadeus_parquet::internal::{
//! file::reader::{FileReader, SerializedFileReader},
//! schema::printer::{print_file_metadata, print_parquet_metadata, print_schema},
//! };
Expand Down
1 change: 1 addition & 0 deletions amadeus-parquet/src/internal/schema/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ impl ColumnPath {

/// Returns string representation of this column path.
/// ```rust
/// use amadeus_parquet::internal;
/// use internal::schema::types::ColumnPath;
///
/// let path = ColumnPath::new(vec!["a".to_string(), "b".to_string(), "c".to_string()]);
Expand Down
10 changes: 2 additions & 8 deletions amadeus-parquet/src/internal/util/test_common/file_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,8 @@ use std::{env, fs, io::Write, path::PathBuf, str::FromStr};

/// Returns path to the test parquet file in 'data' directory
pub fn get_test_path(file_name: &str) -> PathBuf {
let mut pathbuf = match env::var("PARQUET_TEST_DATA") {
Ok(path) => PathBuf::from_str(path.as_str()).unwrap(),
Err(_) => {
let mut pathbuf = env::current_dir().unwrap();
pathbuf.push(PathBuf::from_str("amadeus-testing/data").unwrap());
pathbuf
}
};
let mut pathbuf = env::current_dir().unwrap();
pathbuf.push(PathBuf::from_str("../amadeus-testing/parquet").unwrap());
pathbuf.push(file_name);
pathbuf
}
Expand Down
10 changes: 2 additions & 8 deletions amadeus-parquet/tests/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,8 @@ fn get_test_file(file_name: &str) -> fs::File {
}

fn get_test_path(file_name: &str) -> PathBuf {
let mut pathbuf = match env::var("PARQUET_TEST_DATA") {
Ok(path) => PathBuf::from_str(path.as_str()).unwrap(),
Err(_) => {
let mut pathbuf = env::current_dir().unwrap();
pathbuf.push(PathBuf::from_str("amadeus-testing/data").unwrap());
pathbuf
}
};
let mut pathbuf = env::current_dir().unwrap();
pathbuf.push(PathBuf::from_str("../amadeus-testing/parquet").unwrap());
pathbuf.push(file_name);
pathbuf
}

0 comments on commit 157ee87

Please sign in to comment.