diff --git a/datafusion/core/src/execution/context/mod.rs b/datafusion/core/src/execution/context/mod.rs index 1f1ab446b626..9c500ec07293 100644 --- a/datafusion/core/src/execution/context/mod.rs +++ b/datafusion/core/src/execution/context/mod.rs @@ -858,8 +858,8 @@ impl SessionContext { // check if the file extension matches the expected extension for path in &table_paths { - if !path.as_str().ends_with(&option_extension) { - let file_name = path.prefix().filename().unwrap_or_default(); + let file_name = path.prefix().filename().unwrap_or_default(); + if !path.as_str().ends_with(&option_extension) && file_name.contains('.') { return exec_err!( "File '{file_name}' does not match the expected extension '{option_extension}'" ); diff --git a/datafusion/core/src/execution/context/parquet.rs b/datafusion/core/src/execution/context/parquet.rs index 79dd447446ad..ef1f0143543d 100644 --- a/datafusion/core/src/execution/context/parquet.rs +++ b/datafusion/core/src/execution/context/parquet.rs @@ -138,7 +138,7 @@ mod tests { } #[tokio::test] - async fn read_from_wrong_file_extension() -> Result<()> { + async fn read_from_different_file_extension() -> Result<()> { let ctx = SessionContext::new(); // Make up a new dataframe.