Skip to content

Commit

Permalink
Nit on match
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay Chia committed Sep 30, 2023
1 parent 8c833ec commit 8cd0b0d
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/daft-io/src/object_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,26 @@ pub(crate) async fn glob(
while let Some(val) = results.next().await {
match val {
Ok(fm) => {
// Recursively visit each sub-directory
if matches!(fm.filetype, FileType::Directory) {
visit(
result_tx.clone(),
source.clone(),
// Do not increment `current_fragment_idx` so as to keep visiting the "**" fragmemt
state.advance(fm.filepath.clone(), state.current_fragment_idx),
);
}
// Return any Files that match
if state.full_glob_matcher.is_match(fm.filepath.as_str())
&& matches!(fm.filetype, FileType::File)
{
result_tx.send(Ok(fm)).await.expect("Internal multithreading channel is broken: results may be incorrect");
match fm.filetype {
// Recursively visit each sub-directory
FileType::Directory => {
visit(
result_tx.clone(),
source.clone(),
// Do not increment `current_fragment_idx` so as to keep visiting the "**" fragmemt
state.advance(
fm.filepath.clone(),
state.current_fragment_idx,
),
);
}
// Return any Files that match
FileType::File
if state.full_glob_matcher.is_match(fm.filepath.as_str()) =>
{
result_tx.send(Ok(fm)).await.expect("Internal multithreading channel is broken: results may be incorrect");
}
_ => (),
}
}
Err(e) => {
Expand Down

0 comments on commit 8cd0b0d

Please sign in to comment.