Skip to content

Commit

Permalink
Revert path "fixes" that broke windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Gardner committed Aug 8, 2022
1 parent 2761a7e commit be64e65
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
8 changes: 2 additions & 6 deletions datafusion/core/src/datasource/file_format/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,17 @@ mod tests {
projection: Option<Vec<usize>>,
limit: Option<usize>,
) -> Result<Arc<dyn ExecutionPlan>> {
let store_root = env!("CARGO_MANIFEST_DIR");
let filename = "tests/jsons/2.json";
let format = JsonFormat::default();
scan_format(&format, store_root, filename, projection, limit).await
scan_format(&format, ".", filename, projection, limit).await
}

#[tokio::test]
async fn infer_schema_with_limit() {
let store = Arc::new(LocalFileSystem::new()) as _;
let filename = "tests/jsons/schema_infer_limit.json";
let format = JsonFormat::default().with_schema_infer_max_rec(Some(3));

let store_root = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
let filename = store_root.join("tests/jsons/schema_infer_limit.json");
let filename = filename.to_str().expect("Unable to get path!");

let file_schema = format
.infer_schema(&store, &[local_unpartitioned_file(filename)])
.await
Expand Down
3 changes: 1 addition & 2 deletions datafusion/core/src/physical_plan/file_format/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ mod tests {
let store_url = ObjectStoreUrl::local_filesystem();
let store = ctx.runtime_env().object_store(&store_url).unwrap();

let store_root = Path::new(env!("CARGO_MANIFEST_DIR"));
let path = store_root.join(TEST_DATA_BASE).join("1.json");
let path = format!("{}/1.json", TEST_DATA_BASE);
let meta = local_unpartitioned_file(path);
let schema = JsonFormat::default()
.infer_schema(&store, &[meta.clone()])
Expand Down
3 changes: 1 addition & 2 deletions datafusion/core/src/physical_plan/file_format/parquet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1239,8 +1239,7 @@ mod tests {
async fn parquet_exec_with_error() -> Result<()> {
let session_ctx = SessionContext::new();
let task_ctx = session_ctx.task_ctx();
let store_root = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
let location = Path::from_filesystem_path(store_root)
let location = Path::from_filesystem_path(".")
.unwrap()
.child("invalid.parquet");

Expand Down
5 changes: 2 additions & 3 deletions datafusion/core/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ fn get_data_dir(udf_env: &str, submodule_data: &str) -> Result<PathBuf, Box<dyn
let dir = env!("CARGO_MANIFEST_DIR");

let pb = PathBuf::from(dir).join(submodule_data);
let pb = pb.canonicalize()?;
if pb.is_dir() {
Ok(pb)
} else {
Expand Down Expand Up @@ -326,9 +325,9 @@ mod tests {
#[test]
fn test_data_dir() {
let udf_env = "get_data_dir";
let cwd = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
let cwd = env::current_dir().unwrap();

let existing_pb = cwd.join("..").canonicalize().unwrap();
let existing_pb = cwd.join("..");
let existing = existing_pb.display().to_string();
let existing_str = existing.as_str();

Expand Down

0 comments on commit be64e65

Please sign in to comment.