private List<FetchInputFormatSplit> getNextSplits() throws Exception {
    while (iterPath.hasNext()) {
      currPath = iterPath.next();
      currDesc = iterPartDesc.next();
      // not using FileInputFormat.setInputPaths() here because it forces a connection to the
      // default file system - which may or may not be online during pure metadata operations
      job.set("mapred.input.dir", StringUtils.escapeString(currPath.toString()));

      // Fetch operator is not vectorized and as such turn vectorization flag off so that
      // non-vectorized record reader is created below.
      HiveConf.setBoolVar(job, HiveConf.ConfVars.HIVE_VECTORIZATION_ENABLED, false);

      Class<? extends InputFormat> formatter = currDesc.getInputFileFormatClass();
      Utilities.copyTableJobPropertiesToConf(currDesc.getTableDesc(), job);
      InputFormat inputFormat = getInputFormatFromCache(formatter, job);
      if(inputFormat instanceof HiveSequenceFileInputFormat) {
        // input format could be cached, in which case we need to reset the list of files to fetch
        ((HiveSequenceFileInputFormat) inputFormat).setFiles(null);
      }

      List<Path> dirs = new ArrayList<>(), dirsWithOriginals = new ArrayList<>();
      processCurrPathForMmWriteIds(inputFormat, dirs, dirsWithOriginals);
      if (dirs.isEmpty() && dirsWithOriginals.isEmpty()) {
        LOG.debug("No valid directories for " + currPath);
        continue;
      }

      List<FetchInputFormatSplit> inputSplits = new ArrayList<>();
      if(inputFormat instanceof HiveSequenceFileInputFormat && this.getWork().getFilesToFetch() != null
          && !this.getWork().getFilesToFetch().isEmpty() && !this.getWork().isSourceTable()) {
        HiveSequenceFileInputFormat fileFormat = (HiveSequenceFileInputFormat)inputFormat;
        fileFormat.setFiles(this.getWork().getFilesToFetch());
        InputSplit[] splits = inputFormat.getSplits(job, 1);
        for (int i = 0; i < splits.length; i++) {
          inputSplits.add(new FetchInputFormatSplit(splits[i], inputFormat));
        }
      } else {
        if (!dirs.isEmpty()) {
          String inputs = makeInputString(dirs);
          Utilities.FILE_OP_LOGGER.trace("Setting fetch inputs to {}", inputs);
          job.set("mapred.input.dir", inputs);

          generateWrappedSplits(inputFormat, inputSplits, job);
        }
      }

      if (!dirsWithOriginals.isEmpty()) {
        String inputs = makeInputString(dirsWithOriginals);
        Utilities.FILE_OP_LOGGER.trace("Setting originals fetch inputs to {}", inputs);
        JobConf jobNoRec = HiveInputFormat.createConfForMmOriginalsSplit(job, dirsWithOriginals);
        jobNoRec.set("mapred.input.dir", inputs);
        generateWrappedSplits(inputFormat, inputSplits, jobNoRec);
      }

      if (work.getSplitSample() != null) {
        inputSplits = splitSampling(work.getSplitSample(), inputSplits);
      }

      if (inputSplits.isEmpty()) {
        LOG.debug("No splits for " + currPath);
        continue;
      }
      if (HiveConf.getBoolVar(job, HiveConf.ConfVars.HIVE_IN_TEST)) {
        Collections.sort(inputSplits, new FetchInputFormatSplitComparator());
      }
      return inputSplits;
    }

    return null;
  }
Set context for this fetch operator in to the jobconf.
This helps InputFormats make decisions based on the scope of the complete
operation.
@param conf the configuration to modify
@param paths the list of input directories
ql/src/java/org/apache/hadoop/hive/ql/exec/FetchOperator.java