Skip to content

Commit

Permalink
Filesystem refactor conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Zarnecki committed Jan 9, 2024
1 parent 9b3c9ab commit 25f85ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,8 @@ public function scan(Path $path, PartitionFilter $partitionFilter = new NoopFilt
return false;
}

if ($path->isPattern()) {
if (!$path->matches(new Path($path->scheme() . '://' . $file->path(), $path->options()))) {
return false;
}
if (!$path->matches(new Path($path->scheme() . '://' . $file->path(), $path->options()))) {
return false;
}

return $partitionFilter->keep(...(new Path(DIRECTORY_SEPARATOR . $file->path()))->partitions()->toArray());
Expand Down
15 changes: 0 additions & 15 deletions src/core/etl/src/Flow/ETL/Filesystem/LocalFilesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,6 @@ public function scan(Path $path, PartitionFilter $partitionFilter = new NoopFilt
}

throw new RuntimeException(\sprintf('Path "%s" does not exists', $path->uri()));

}

if (!$path->isPattern()) {
foreach (Glob::glob(\rtrim($path->path(), '/') . '/**/*') as $filePath) {
if (\is_dir($filePath)) {
continue;
}

if ($partitionFilter->keep(...(Path::realpath($filePath, $path->options()))->partitions()->toArray())) {
yield Path::realpath($filePath, $path->options());
}
}

return;
}

foreach (Glob::glob($path->path()) as $filePath) {
Expand Down

0 comments on commit 25f85ce

Please sign in to comment.