MCPcopy Create free account
hub / github.com/apache/pig / getFirstFile

Method getFirstFile

src/org/apache/pig/builtin/OrcStorage.java:399–418  ·  view source on GitHub ↗
(String location, FileSystem fs, PathFilter filter)

Source from the content-addressed store, hash-verified

397 }
398
399 private static Path getFirstFile(String location, FileSystem fs, PathFilter filter) throws IOException {
400 String[] locations = getPathStrings(location);
401 Path[] paths = new Path[locations.length];
402 for (int i = 0; i < paths.length; ++i) {
403 paths[i] = new Path(locations[i]);
404 }
405 List<FileStatus> statusList = new ArrayList<FileStatus>();
406 for (int i = 0; i < paths.length; ++i) {
407 FileStatus[] files = fs.globStatus(paths[i]);
408 if (files != null) {
409 for (FileStatus tempf : files) {
410 statusList.add(tempf);
411 }
412 }
413 }
414 FileStatus[] statusArray = (FileStatus[]) statusList
415 .toArray(new FileStatus[statusList.size()]);
416 Path p = Utils.depthFirstSearchForFile(statusArray, fs, filter);
417 return p;
418 }
419
420 @Override
421 public ResourceSchema getSchema(String location, Job job)

Callers 1

Calls 5

toArrayMethod · 0.80
addMethod · 0.65
sizeMethod · 0.65
getPathStringsMethod · 0.45

Tested by

no test coverage detected