Java Code Examples for org.apache.hadoop.mapreduce.MapContext#getInputSplit()

The following examples show how to use org.apache.hadoop.mapreduce.MapContext#getInputSplit() . 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: ChainMapContextImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public InputSplit getInputSplit() {
  if (base instanceof MapContext) {
    MapContext<KEYIN, VALUEIN, KEYOUT, VALUEOUT> mc = 
      (MapContext<KEYIN, VALUEIN, KEYOUT, VALUEOUT>) base;
    return mc.getInputSplit();
  } else {
    return null;
  }
}
 
Example 2
Source File: ChainMapContextImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public InputSplit getInputSplit() {
  if (base instanceof MapContext) {
    MapContext<KEYIN, VALUEIN, KEYOUT, VALUEOUT> mc = 
      (MapContext<KEYIN, VALUEIN, KEYOUT, VALUEOUT>) base;
    return mc.getInputSplit();
  } else {
    return null;
  }
}
 
Example 3
Source File: HadoopExecutableManager.java    From spork with Apache License 2.0 5 votes vote down vote up
private void writeDebugHeader() {
    processError("===== Task Information Header =====" );

    processError("\nCommand: " + command);
    processError("\nStart time: " + new Date(System.currentTimeMillis()));
    if (job.getBoolean(MRConfiguration.TASK_IS_MAP, false)) {
        MapContext context = (MapContext)PigMapReduce.sJobContext;
        PigSplit pigSplit = (PigSplit)context.getInputSplit();
        int numPaths = pigSplit.getNumPaths();
        processError("\nPigSplit contains " + numPaths + " wrappedSplits.");

        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < numPaths; i++) {
          InputSplit wrappedSplit = pigSplit.getWrappedSplit(i);
          if (wrappedSplit instanceof FileSplit) {
              FileSplit mapInputFileSplit = (FileSplit)wrappedSplit;
              sb.append("\nInput-split: file=");
              sb.append(mapInputFileSplit.getPath());
              sb.append(" start-offset=");
              sb.append(Long.toString(mapInputFileSplit.getStart()));
              sb.append(" length=");
              sb.append(Long.toString(mapInputFileSplit.getLength()));
              processError(sb.toString());
              sb.setLength(0);
          }
        }
    }
    processError("\n=====          * * *          =====\n");
}