@Override
  public FileStatus next() {
    if (eventsBatched) {
      FileStatus event = eventDirs[currentIndex++];
      if (hasNextBatch() && currentIndex == numEvents) {
        try {
          eventDirs = fs.listStatus(eventBatchDirsIterator.next().getPath(), ReplUtils.getEventsDirectoryFilter(fs));
          Arrays.sort(eventDirs, new EventDumpDirComparator());
          currentIndex = 0;
          numEvents = eventDirs.length;
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return event;
    }
    else if (hasNext()) {
      return eventDirs[currentIndex++];
    } else {
      throw new NoSuchElementException("no more events");
    }
  }
IncrementalLoadEventsIterator
Helper class to iterate through event dump directory.
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/incremental/IncrementalLoadEventsIterator.java