Example usage for org.apache.hadoop.mapreduce.lib.input FileInputFormat getInputDirRecursive

List of usage examples for org.apache.hadoop.mapreduce.lib.input FileInputFormat getInputDirRecursive

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce.lib.input FileInputFormat getInputDirRecursive.

Prototype

public static boolean getInputDirRecursive(JobContext job) 

Source Link

Usage

From source file:org.apache.jena.hadoop.rdf.io.input.AbstractNLineFileInputFormat.java

License:Apache License

/**
 * Logically splits the set of input files for the job, splits N lines of
 * the input as one split.// www . j ava 2 s .c  o  m
 * 
 * @see FileInputFormat#getSplits(JobContext)
 */
@Override
public final List<InputSplit> getSplits(JobContext job) throws IOException {
    boolean debug = LOGGER.isDebugEnabled();
    if (debug && FileInputFormat.getInputDirRecursive(job)) {
        LOGGER.debug("Recursive searching for input data is enabled");
    }

    List<InputSplit> splits = new ArrayList<InputSplit>();
    int numLinesPerSplit = NLineInputFormat.getNumLinesPerSplit(job);
    for (FileStatus status : listStatus(job)) {
        if (debug) {
            LOGGER.debug("Determining how to split input file/directory {}", status.getPath());
        }
        splits.addAll(NLineInputFormat.getSplitsForFile(status, job.getConfiguration(), numLinesPerSplit));
    }
    return splits;
}