Java Code Examples for org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil#toProperties()

The following examples show how to use org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil#toProperties() . 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: PhoenixHBaseLoaderIT.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() throws Exception {
    pigServer = new PigServer(ExecType.LOCAL,
            ConfigurationUtil.toProperties(conf));
}
 
Example 3
Source File: PigTestBase.java    From stratio-cassandra with Apache License 2.0 4 votes vote down vote up
@Before
public void beforeTest() throws Exception {
    pig = new PigServer(new PigContext(ExecType.LOCAL, ConfigurationUtil.toProperties(conf)));
    PigContext.initializeImportList("org.apache.cassandra.hadoop.pig");   
}
 
Example 4
Source File: MiniGenericCluster.java    From stratio-cassandra with Apache License 2.0 4 votes vote down vote up
public Properties getProperties() {
    errorIfNotSetup();
    return ConfigurationUtil.toProperties(m_conf);
}
 
Example 5
Source File: PigContext.java    From spork with Apache License 2.0 4 votes vote down vote up
public PigContext(Configuration conf) throws PigException {
    this(ConfigurationUtil.toProperties(conf));
}
 
Example 6
Source File: PigContext.java    From spork with Apache License 2.0 4 votes vote down vote up
public PigContext(ExecType execType, Configuration conf) {
    this(execType, ConfigurationUtil.toProperties(conf));
}
 
Example 7
Source File: FILTERFROMFILE.java    From spork with Apache License 2.0 4 votes vote down vote up
private void init() throws IOException {
    
	lookupTable = new HashMap<String, Boolean>();
	
	Properties props = ConfigurationUtil.toProperties(PigMapReduce.sJobConfInternal.get());
	InputStream is = FileLocalizer.openDFSFile(FilterFileName, props);

	BufferedReader reader = new BufferedReader(new InputStreamReader(is));
	
	while (true){
		String line = reader.readLine();

		if (line == null)
			break;

		String FilterField = line.split("\t")[0];
		
		lookupTable.put(FilterField, Boolean.TRUE);
	}
}
 
Example 8
Source File: MiniGenericCluster.java    From spork with Apache License 2.0 4 votes vote down vote up
public Properties getProperties() {
    errorIfNotSetup();
    return ConfigurationUtil.toProperties(m_conf);
}