private OrcFileMetadata getFileFooterFromCacheOrDisk() throws IOException {
    LlapBufferOrBuffers tailBuffers = null;
    List<StripeStatistics> stats = null;
    List<StripeInformation> stripes = null;
    boolean hasCache = fileKey != null && metadataCache != null;
    if (hasCache) {
      tailBuffers = metadataCache.getFileMetadata(fileKey);
      if (tailBuffers != null) {
        try {
          OrcTail orcTail = getOrcTailFromLlapBuffers(tailBuffers);
          counters.incrCounter(LlapIOCounters.METADATA_CACHE_HIT);
          FileTail tail = orcTail.getFileTail();
          stats = getStripeStatsFromOrcTail(orcTail);
          stripes = new ArrayList<>(tail.getFooter().getStripesCount());
          int stripeIdx = 0;
          for (OrcProto.StripeInformation stripeProto : tail.getFooter().getStripesList()) {
            stripes.add(new ReaderImpl.StripeInformationImpl(stripeProto, stripeIdx++, -1, null));
          }
          return new OrcFileMetadata(
              fileKey, tail.getFooter(), tail.getPostscript(), stats, stripes,
              ReaderImpl.getFileVersion(tail.getPostscript().getVersionList()));
        } finally {
          // We don't need the buffer anymore.
          metadataCache.decRefBuffer(tailBuffers);
        }
      } else {
        counters.incrCounter(LlapIOCounters.METADATA_CACHE_MISS);
        throwIfCacheOnlyRead(isReadCacheOnly);
      }
    }
    ensureOrcReader();
    ByteBuffer tailBufferBb = orcReader.getSerializedFileFooter();
    if (hasCache) {
      tailBuffers = metadataCache.putFileMetadata(fileKey, tailBufferBb, cacheTag, isStopped);
      metadataCache.decRefBuffer(tailBuffers); // We don't use the cache's copy of the buffer.
    }
    FileTail ft = orcReader.getFileTail();
    return new OrcFileMetadata(fileKey, ft.getFooter(), ft.getPostscript(),
        orcReader.getOrcProtoStripeStatistics(), orcReader.getStripes(), orcReader.getFileVersion());
  }
Gets file metadata for the split from cache, or reads it from the file.
llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java