@Override
    public OrcIndex readRowIndex(StripeInformation stripe,
        TypeDescription fileSchema,
        OrcProto.StripeFooter footer,
        boolean ignoreNonUtf8BloomFilter,
        boolean[] included,
        OrcProto.RowIndex[] indexes,
        boolean[] sargColumns,
        OrcFile.WriterVersion version,
        OrcProto.Stream.Kind[] bloomFilterKinds,
        OrcProto.BloomFilterIndex[] bloomFilterIndices
    ) throws IOException {
      if (!isOpen) {
        open();
      }
      if (footer == null) {
        footer = readStripeFooter(stripe);
      }
      if (indexes == null) {
        indexes = new OrcProto.RowIndex[fileSchema.getMaximumId() + 1];
      }
      if (bloomFilterKinds == null) {
        bloomFilterKinds = new OrcProto.Stream.Kind[fileSchema.getMaximumId() + 1];
      }
      if (bloomFilterIndices == null) {
        bloomFilterIndices = new OrcProto.BloomFilterIndex[fileSchema.getMaximumId() + 1];
      }
      DiskRangeList ranges = planIndexReading(fileSchema, footer,
          ignoreNonUtf8BloomFilter, included, sargColumns, version,
          bloomFilterKinds);
      ranges = readDiskRanges(file, zcr, stripe.getOffset(), ranges, false, maxDiskRangeChunkLimit);
      long offset = 0;
      DiskRangeList range = ranges;
      for(OrcProto.Stream stream: footer.getStreamsList()) {
        // advance to find the next range
        while (range != null && range.getEnd() <= offset) {
          range = range.next;
        }
        // no more ranges, so we are done
        if (range == null) {
          break;
        }
        InStream.StreamOptions compression = null;
        try (CompressionCodec codec = OrcCodecPool.getCodec(compressionKind)) {
          if (codec != null) {
            compression = InStream.options().withCodec(codec).withBufferSize(bufferSize);
          }
        }

        int column = stream.getColumn();
        if (stream.hasKind() && range.getOffset() <= offset) {
          switch (stream.getKind()) {
          case ROW_INDEX:
            if (included == null || included[column]) {
              ByteBuffer bb = range.getData().duplicate();
              bb.position((int) (offset - range.getOffset()));
              bb.limit((int) (bb.position() + stream.getLength()));
              indexes[column] = OrcProto.RowIndex.parseFrom(
                  InStream.createCodedInputStream(
                      InStream.create("index",
                      new BufferChunk(bb, 0), 0,
                      stream.getLength(), compression)));
            }
            break;
          case BLOOM_FILTER:
          case BLOOM_FILTER_UTF8:
            if (sargColumns != null && sargColumns[column]) {
              ByteBuffer bb = range.getData().duplicate();
              bb.position((int) (offset - range.getOffset()));
              bb.limit((int) (bb.position() + stream.getLength()));
              bloomFilterIndices[column] = OrcProto.BloomFilterIndex.parseFrom(
                  InStream.createCodedInputStream(
                      InStream.create("bloom_filter",
                      new BufferChunk(bb, 0), 0,
                      stream.getLength(), compression)));
            }
            break;
          default:
            break;
          }
        }
        offset += stream.getLength();
      }
      return new OrcIndex(indexes, bloomFilterKinds, bloomFilterIndices);
    }
Plans the list of disk ranges that the given stripe needs to read the
indexes. All of the positions are relative to the start of the stripe.
@param  fileSchema the schema for the file
@param footer the stripe footer
@param ignoreNonUtf8BloomFilter should the reader ignore non-utf8
                                encoded bloom filters
@param fileIncluded the columns (indexed by file columns) that should be
                    read
@param sargColumns true for the columns (indexed by file columns) that
                   we need bloom filters for
@param version the version of the software that wrote the file
@param bloomFilterKinds (output) the stream kind of the bloom filters
@return a list of merged disk ranges to read
llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/LlapRecordReaderUtils.java