Example usage for org.apache.hadoop.mapred JobConf iterator

List of usage examples for org.apache.hadoop.mapred JobConf iterator

Introduction

In this page you can find the example usage for org.apache.hadoop.mapred JobConf iterator.

Prototype

@Override
public Iterator<Map.Entry<String, String>> iterator() 

Source Link

Document

Get an Iterator to go through the list of String key-value pairs in the configuration.

Usage

From source file:pp.InputFormatWrapper.java

License:Open Source License

@Override
public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException {
    String className = job.get("pretty.pipes.input.format");

    pp.Configuration conf = new pp.Configuration();

    Iterator<Map.Entry<String, String>> it = job.iterator();
    while (it.hasNext()) {
        Map.Entry<String, String> e = it.next();
        conf.set(e.getKey(), e.getValue());
    }//from  w ww.  j  a v  a  2 s .c  om
    String pluginStr = job.get("pretty.pipes.plugins");
    System.out.println("plugins: " + pluginStr);
    System.out.flush();
    String[] plugins = new String[0];
    if (pluginStr.isEmpty() == false) {
        plugins = pluginStr.split(",");
    }
    for (int i = 0; i < plugins.length; i++) {
        Plugins.loadLibrary(plugins[i]);
    }

    System.out.println("Creating input format: " + className);
    pp.InputFormat pif = pp.InputFormat.create(className);

    pif.setConfiguration(conf);

    InputSplit[] result = new InputSplit[pif.getSplitCount()];
    for (int i = 0; i < pif.getSplitCount(); i++) {
        pp.InputSplit pis = pif.getSplit(i);
        result[i] = new InputSplitWrapper(pis);
    }

    return result;
}