Created
August 27, 2015 05:31
-
-
Save akhld/9419c91fa142984f7aa2 to your computer and use it in GitHub Desktop.
Reading files with colon in the name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Configuration hadoopConf = sparkContext.hadoopConfiguration(); | |
hadoopConf.set("fs." + CustomS3FileSystem.SCHEMA + ".impl", | |
CustomS3FileSystem.class.getName()); | |
public class CustomS3FileSystem extends NativeS3FileSystem { | |
public static final String SCHEMA = "custom"; | |
@Override | |
public FileStatus[] globStatus(final Path pathPattern, final PathFilter filter) | |
throws IOException { | |
final FileStatus[] statusList = super.listStatus(pathPattern); | |
final List<FileStatus> result = Lists.newLinkedList(); | |
for (FileStatus fileStatus : statusList) { | |
if (filter.accept(fileStatus.getPath())) { | |
result.add(fileStatus); | |
} | |
} | |
return result.toArray(new FileStatus[] {}); | |
} | |
} | |
view raw |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment