Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Filter out size-0 directory marker files during s3 globs #1629

Merged
merged 3 commits into from
Nov 17, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/daft-io/src/object_store_glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,14 @@ pub(crate) async fn glob(
let to_rtn_stream = stream! {
let mut remaining_results = limit;
while remaining_results.map(|rr| rr > 0).unwrap_or(true) && let Some(v) = to_rtn_rx.recv().await {

// Filter the result stream for any size-0 File entries that end with "/"
// These are usually used to demarcate "empty folders", since S3 is not really a filesystem
// However they can lead to unexpected globbing behavior since most users do not expect them to exist
if v.as_ref().is_ok_and(|v| v.filepath.ends_with(GLOB_DELIMITER)) {
jaychia marked this conversation as resolved.
Show resolved Hide resolved
continue
}

remaining_results = remaining_results.map(|rr| rr - 1);
yield v
}
Expand Down
Loading