This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new ceb09b2576 use tmp directory in test (#8115)
ceb09b2576 is described below
commit ceb09b2576ba1727d2f67c88b4f10cf08f20be41
Author: Yongting You <[email protected]>
AuthorDate: Sat Nov 11 03:16:08 2023 -0800
use tmp directory in test (#8115)
---
datafusion/core/src/execution/context/parquet.rs | 34 +++++++++++++++++++-----
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/datafusion/core/src/execution/context/parquet.rs
b/datafusion/core/src/execution/context/parquet.rs
index ef1f014354..821b1ccf18 100644
--- a/datafusion/core/src/execution/context/parquet.rs
+++ b/datafusion/core/src/execution/context/parquet.rs
@@ -80,6 +80,7 @@ mod tests {
use crate::dataframe::DataFrameWriteOptions;
use crate::parquet::basic::Compression;
use crate::test_util::parquet_test_data;
+ use tempfile::tempdir;
use super::*;
@@ -137,6 +138,7 @@ mod tests {
Ok(())
}
+ #[cfg(not(target_family = "windows"))]
#[tokio::test]
async fn read_from_different_file_extension() -> Result<()> {
let ctx = SessionContext::new();
@@ -155,11 +157,29 @@ mod tests {
],
)?)?;
+ let temp_dir = tempdir()?;
+ let temp_dir_path = temp_dir.path();
+ let path1 = temp_dir_path
+ .join("output1.parquet")
+ .to_str()
+ .unwrap()
+ .to_string();
+ let path2 = temp_dir_path
+ .join("output2.parquet.snappy")
+ .to_str()
+ .unwrap()
+ .to_string();
+ let path3 = temp_dir_path
+ .join("output3.parquet.snappy.parquet")
+ .to_str()
+ .unwrap()
+ .to_string();
+
// Write the dataframe to a parquet file named 'output1.parquet'
write_df
.clone()
.write_parquet(
- "output1.parquet",
+ &path1,
DataFrameWriteOptions::new().with_single_file_output(true),
Some(
WriterProperties::builder()
@@ -173,7 +193,7 @@ mod tests {
write_df
.clone()
.write_parquet(
- "output2.parquet.snappy",
+ &path2,
DataFrameWriteOptions::new().with_single_file_output(true),
Some(
WriterProperties::builder()
@@ -186,7 +206,7 @@ mod tests {
// Write the dataframe to a parquet file named
'output3.parquet.snappy.parquet'
write_df
.write_parquet(
- "output3.parquet.snappy.parquet",
+ &path3,
DataFrameWriteOptions::new().with_single_file_output(true),
Some(
WriterProperties::builder()
@@ -199,7 +219,7 @@ mod tests {
// Read the dataframe from 'output1.parquet' with the default file
extension.
let read_df = ctx
.read_parquet(
- "output1.parquet",
+ &path1,
ParquetReadOptions {
..Default::default()
},
@@ -213,7 +233,7 @@ mod tests {
// Read the dataframe from 'output2.parquet.snappy' with the correct
file extension.
let read_df = ctx
.read_parquet(
- "output2.parquet.snappy",
+ &path2,
ParquetReadOptions {
file_extension: "snappy",
..Default::default()
@@ -227,7 +247,7 @@ mod tests {
// Read the dataframe from 'output3.parquet.snappy.parquet' with the
wrong file extension.
let read_df = ctx
.read_parquet(
- "output2.parquet.snappy",
+ &path2,
ParquetReadOptions {
..Default::default()
},
@@ -242,7 +262,7 @@ mod tests {
// Read the dataframe from 'output3.parquet.snappy.parquet' with the
correct file extension.
let read_df = ctx
.read_parquet(
- "output3.parquet.snappy.parquet",
+ &path3,
ParquetReadOptions {
..Default::default()
},