Skip to content

Commit

Permalink
Extract filter
Browse files Browse the repository at this point in the history
  • Loading branch information
devinrsmith committed Nov 6, 2023
1 parent 7196669 commit 81facb6
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,7 @@ private static Table readTableInternal(
final Path firstEntryPath;
// Ignore dot files while looking for the first entry
try (final DirectoryStream<Path> sourceStream =
Files.newDirectoryStream(sourcePath, (path) -> {
final String filename = path.getFileName().toString();
return !filename.isEmpty() && filename.charAt(0) != '.';
})) {
Files.newDirectoryStream(sourcePath, ParquetTools::ignoreDotFiles)) {
// Lexicographical comparison
firstEntryPath = StreamSupport.stream(sourceStream.spliterator(), false)
.min(Path::compareTo)
Expand All @@ -622,6 +619,11 @@ private static Table readTableInternal(
throw new TableDataException("Source " + source + " is neither a directory nor a regular file");
}

private static boolean ignoreDotFiles(Path path) {
final String filename = path.getFileName().toString();
return !filename.isEmpty() && filename.charAt(0) != '.';
}

private static BasicFileAttributes readAttributes(@NotNull final Path path) {
try {
return Files.readAttributes(path, BasicFileAttributes.class);
Expand Down

0 comments on commit 81facb6

Please sign in to comment.