You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ks...@apache.org on 2019/03/01 07:16:11 UTC

[arrow] branch master updated: ARROW-4072: [Rust] Set default value for PARQUET_TEST_DATA

This is an automated email from the ASF dual-hosted git repository.

kszucs pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 32d154a  ARROW-4072: [Rust] Set default value for PARQUET_TEST_DATA
32d154a is described below

commit 32d154a9a3599046a7a1a9bc754a424dceb8a2fb
Author: Nicolas Trinquier <ns...@protonmail.ch>
AuthorDate: Fri Mar 1 08:15:55 2019 +0100

    ARROW-4072: [Rust] Set default value for PARQUET_TEST_DATA
    
    Author: Nicolas Trinquier <ns...@protonmail.ch>
    
    Closes #3783 from ntrinquier/ARROW-4072 and squashes the following commits:
    
    52603cae <Nicolas Trinquier> Set default value for PARQUET_TEST_DATA
---
 rust/README.md                                 |  2 +-
 rust/parquet/src/util/test_common/file_util.rs | 16 +++++++++++-----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/rust/README.md b/rust/README.md
index 9f3c9f1..b09150b 100644
--- a/rust/README.md
+++ b/rust/README.md
@@ -47,7 +47,7 @@ This populates data in two git submodules:
 - `testing` (sourced from https://github.com/apache/arrow-testing)
 
 Create a new environment variable called `PARQUET_TEST_DATA` to point
-to `cpp/submodules/parquet_testing/data` and then `cargo test` as usual.
+to `cpp/submodules/parquet-testing/data` and then `cargo test` as usual.
 
 ## Code Formatting
 
diff --git a/rust/parquet/src/util/test_common/file_util.rs b/rust/parquet/src/util/test_common/file_util.rs
index ec192a3..14f4357 100644
--- a/rust/parquet/src/util/test_common/file_util.rs
+++ b/rust/parquet/src/util/test_common/file_util.rs
@@ -19,11 +19,17 @@ 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 result = env::var("PARQUET_TEST_DATA");
-    if result.is_err() {
-        panic!("Please point PARQUET_TEST_DATA environment variable to the test data directory");
-    }
-    let mut pathbuf = PathBuf::from_str(result.unwrap().as_str()).unwrap();
+    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.pop();
+            pathbuf.pop();
+            pathbuf
+                .push(PathBuf::from_str("cpp/submodules/parquet-testing/data").unwrap());
+            pathbuf
+        }
+    };
     pathbuf.push(file_name);
     pathbuf
 }