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

Method getSchema

src/org/apache/pig/builtin/BinStorage.java:397–424  ·  view source on GitHub ↗
(String location, Job job)

Source from the content-addressed store, hash-verified

395 }
396
397 @SuppressWarnings("deprecation")
398 @Override
399 public ResourceSchema getSchema(String location, Job job)
400 throws IOException {
401 Configuration conf = job.getConfiguration();
402 Properties props = ConfigurationUtil.toProperties(conf);
403
404 // At compile time in batch mode, the file may not exist
405 // (such as intermediate file). Just return null - the
406 // same way as we would if we did not get a valid record
407 String[] locations = getPathStrings(location);
408 for (String loc : locations) {
409 // since local mode now is implemented as hadoop's local mode
410 // we can treat either local or hadoop mode as hadoop mode - hence
411 // we can use HDataStorage and FileLocalizer.openDFSFile below
412 HDataStorage storage;
413 try {
414 storage = new HDataStorage((new org.apache.hadoop.fs.Path(loc)).toUri(), props);
415 } catch (RuntimeException e) {
416 throw new IOException(e);
417 }
418 if (!FileLocalizer.fileExists(loc, storage)) {
419 return null;
420 }
421 }
422
423 return Utils.getSchema(this, location, false, job);
424 }
425
426 @Override
427 public ResourceStatistics getStatistics(String location, Job job)

Callers

nothing calls this directly

Calls 5

toPropertiesMethod · 0.95
fileExistsMethod · 0.95
getSchemaMethod · 0.95
getConfigurationMethod · 0.65
getPathStringsMethod · 0.45

Tested by

no test coverage detected