diff --git a/crates/polars-io/src/path_utils/mod.rs b/crates/polars-io/src/path_utils/mod.rs index f6025ef78aea..be1f0c947df7 100644 --- a/crates/polars-io/src/path_utils/mod.rs +++ b/crates/polars-io/src/path_utils/mod.rs @@ -174,10 +174,13 @@ pub fn expand_paths_hive( let prefix = object_path_from_string(cloud_location.prefix.clone())?; - let out = if !path.ends_with("/") - && cloud_location.expansion.is_none() - && store.head(&prefix).await.is_ok() - { + let out = if !path.ends_with("/") && cloud_location.expansion.is_none() && { + // We need to check if it is a directory for local paths (we can be here due + // to FORCE_ASYNC). For cloud paths the convention is that the user must add + // a trailing slash `/` to scan directories. We don't infer it as that would + // mean sending one network request per path serially (very slow). + is_cloud || PathBuf::from(path).is_file() + } { ( 0, vec![PathBuf::from(format_path(