Skip to content

Commit d1e9f15

Browse files
belugabehrrdblue
authored andcommitted
PARQUET-1513: Update HiddenFileFilter to avoid extra startsWith (#606)
1 parent 1e62e2e commit d1e9f15

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

parquet-hadoop/src/main/java/org/apache/parquet/hadoop/util/HiddenFileFilter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@
2121
import org.apache.hadoop.fs.Path;
2222
import org.apache.hadoop.fs.PathFilter;
2323

24+
/**
25+
* A {@link PathFilter} that filters out hidden files. A file is considered to
26+
* be hidden, and should not be considered for processing, when the file name
27+
* starts with a period ('.') or an underscore ('_').
28+
*/
2429
public class HiddenFileFilter implements PathFilter {
2530
public static final HiddenFileFilter INSTANCE = new HiddenFileFilter();
2631

2732
private HiddenFileFilter() {}
2833

2934
@Override
3035
public boolean accept(Path p) {
31-
return !p.getName().startsWith("_") && !p.getName().startsWith(".");
36+
final char c = p.getName().charAt(0);
37+
return c != '.' && c != '_';
3238
}
3339
}

0 commit comments

Comments
 (0)