Java Code Examples for org.apache.pig.impl.util.Utils#getSchema()

The following examples show how to use org.apache.pig.impl.util.Utils#getSchema() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BinStorage.java    From spork with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public ResourceSchema getSchema(String location, Job job)
        throws IOException {
    Configuration conf = job.getConfiguration();
    Properties props = ConfigurationUtil.toProperties(conf);

    // At compile time in batch mode, the file may not exist
    // (such as intermediate file). Just return null - the
    // same way as we would if we did not get a valid record
    String[] locations = getPathStrings(location);
    for (String loc : locations) {
        // since local mode now is implemented as hadoop's local mode
        // we can treat either local or hadoop mode as hadoop mode - hence
        // we can use HDataStorage and FileLocalizer.openDFSFile below
        HDataStorage storage;
        try {
        	storage = new HDataStorage((new org.apache.hadoop.fs.Path(loc)).toUri(), props);
        } catch (RuntimeException e) {
            throw new IOException(e);
        }
        if (!FileLocalizer.fileExists(loc, storage)) {
            return null;
        }
    }

    return Utils.getSchema(this, location, false, job);
}
 
Example 2
Source File: SequenceFileInterStorage.java    From spork with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceSchema getSchema(String location, Job job)
                throws IOException {
    return Utils.getSchema(this, location, true, job);
}
 
Example 3
Source File: InterStorage.java    From spork with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceSchema getSchema(String location, Job job)
        throws IOException {
    return Utils.getSchema(this, location, true, job);
}
 
Example 4
Source File: TFileStorage.java    From spork with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceSchema getSchema(String location, Job job)
                throws IOException {
    return Utils.getSchema(this, location, true, job);
}
 
Example 5
Source File: TFileLoader.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceSchema getSchema(String location, Job job)
    throws IOException {
  return Utils.getSchema(this, location, true, job);
}