diff --git a/datafusion/core/src/datasource/file_format/json.rs b/datafusion/core/src/datasource/file_format/json.rs index 3075d46144e5..9a889ab4c0f5 100644 --- a/datafusion/core/src/datasource/file_format/json.rs +++ b/datafusion/core/src/datasource/file_format/json.rs @@ -231,21 +231,17 @@ mod tests { projection: Option>, limit: Option, ) -> Result> { - 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 diff --git a/datafusion/core/src/physical_plan/file_format/json.rs b/datafusion/core/src/physical_plan/file_format/json.rs index fa0a0b4adf8b..6cc864312ded 100644 --- a/datafusion/core/src/physical_plan/file_format/json.rs +++ b/datafusion/core/src/physical_plan/file_format/json.rs @@ -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()]) diff --git a/datafusion/core/src/physical_plan/file_format/parquet.rs b/datafusion/core/src/physical_plan/file_format/parquet.rs index ce332b201dfd..df939c4ded35 100644 --- a/datafusion/core/src/physical_plan/file_format/parquet.rs +++ b/datafusion/core/src/physical_plan/file_format/parquet.rs @@ -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"); diff --git a/datafusion/core/src/test_util.rs b/datafusion/core/src/test_util.rs index dd48815d752f..ee53a424c82e 100644 --- a/datafusion/core/src/test_util.rs +++ b/datafusion/core/src/test_util.rs @@ -223,7 +223,6 @@ fn get_data_dir(udf_env: &str, submodule_data: &str) -> Result