parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [parquet-mr] branch master updated: PARQUET-1513: Update HiddenFileFilter to avoid extra startsWith (#606)
Date Sun, 27 Jan 2019 19:38:07 GMT
This is an automated email from the ASF dual-hosted git repository.

blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-mr.git


The following commit(s) were added to refs/heads/master by this push:
     new d1e9f15  PARQUET-1513: Update HiddenFileFilter to avoid extra startsWith (#606)
d1e9f15 is described below

commit d1e9f15d1e94956f38880fec2cf9491b8f9711e4
Author: BELUGABEHR <BELUGABEHR@users.noreply.github.com>
AuthorDate: Sun Jan 27 14:38:02 2019 -0500

    PARQUET-1513: Update HiddenFileFilter to avoid extra startsWith (#606)
---
 .../java/org/apache/parquet/hadoop/util/HiddenFileFilter.java     | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/util/HiddenFileFilter.java
b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/util/HiddenFileFilter.java
index 1817bb2..d5de341 100644
--- a/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/util/HiddenFileFilter.java
+++ b/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/util/HiddenFileFilter.java
@@ -21,6 +21,11 @@ package org.apache.parquet.hadoop.util;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.PathFilter;
 
+/**
+ * A {@link PathFilter} that filters out hidden files. A file is considered to
+ * be hidden, and should not be considered for processing, when the file name
+ * starts with a period ('.') or an underscore ('_').
+ */
 public class HiddenFileFilter implements PathFilter {
   public static final HiddenFileFilter INSTANCE = new HiddenFileFilter();
 
@@ -28,6 +33,7 @@ public class HiddenFileFilter implements PathFilter {
 
   @Override
   public boolean accept(Path p) {
-    return !p.getName().startsWith("_") && !p.getName().startsWith(".");
+    final char c = p.getName().charAt(0);
+    return c != '.' && c != '_';
   }
 }


Mime
View raw message