public static OrcTail getOrcTailForPath(Path path, Configuration jobConf, CacheTag tag,
      Configuration daemonConf, MetadataCache metadataCache, Object fileKey) throws IOException {
    Supplier<FileSystem> fsSupplier = getFsSupplier(path, jobConf);
    if (fileKey == null) {
      fileKey = LlapHiveUtils.createFileIdUsingFS(fsSupplier.get(), path, daemonConf);
    }

    if(fileKey == null || metadataCache == null) {
      throw new IllegalCacheConfigurationException("LLAP metadata cache not available for path " + path.toString());
    }

    LlapBufferOrBuffers tailBuffers = metadataCache.getFileMetadata(fileKey);
    try {
      // Cache hit
      if (tailBuffers != null) {
        return getOrcTailFromLlapBuffers(tailBuffers);
      }

      // Cache miss
      throwIfCacheOnlyRead(HiveConf.getBoolVar(jobConf, ConfVars.LLAP_IO_CACHE_ONLY));

      ReaderOptions opts = EncodedOrcFile.readerOptions(jobConf).filesystem(fsSupplier);
      try (Reader reader = EncodedOrcFile.createReader(path, opts)) {
        ByteBuffer tailBufferBb = reader.getSerializedFileFooter();
        tailBuffers = metadataCache.putFileMetadata(fileKey, tailBufferBb, tag, new AtomicBoolean(false));
        return getOrcTailFromLlapBuffers(tailBuffers);
      }
    } finally {
      // By this time buffers got locked at either cache look up or cache insert times.
      if (tailBuffers != null) {
        metadataCache.decRefBuffer(tailBuffers);
      }
    }

  }
Looks up metadata for the given Orc file in the cache. Will read it in, in case of a cache miss.
@param path
@param jobConf
@param tag
@param daemonConf
@param metadataCache
@return
@throws IOException
llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java