public boolean initializeBuffer(JobConf job, int footerCount, LongWritable key, Text value) throws IOException {
    // Fill the buffer with key value pairs.
    this.footerBuffer = new ArrayList<>();
    while (footerBuffer.size() < footerCount) {
      boolean notEOF = super.next(key, value);
      if (!notEOF) {
        return false;
      }
      WritableComparable left = ReflectionUtils.copy(job, key, null);
      Writable right = ReflectionUtils.copy(job, value, null);
      Pair<WritableComparable, Writable> tem = Pair.of(left, right);
      footerBuffer.add(tem);
    }
    this.cur = 0;
    return true;
  }
When file doesn't end after skipping header line
and there IS footer lines, update footerBuffer
ql/src/java/org/apache/hadoop/hive/ql/io/RecordReaderWrapper.java