Skip to content

Instantly share code, notes, and snippets.

@akhld
Created August 27, 2015 05:31
Show Gist options
  • Save akhld/9419c91fa142984f7aa2 to your computer and use it in GitHub Desktop.
Save akhld/9419c91fa142984f7aa2 to your computer and use it in GitHub Desktop.
Reading files with colon in the name
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