@SuppressWarnings("squid:S2095")
  public synchronized TsFileSequenceReader get(
      String filePath, boolean isClosed, LongConsumer ioSizeRecorder) throws IOException {

    Map<String, TsFileSequenceReader> readerMap =
        !isClosed ? unclosedFileReaderMap : closedFileReaderMap;
    if (!readerMap.containsKey(filePath)) {
      int currentOpenedReaderCount = readerMap.size();
      if (currentOpenedReaderCount >= MAX_CACHED_FILE_SIZE
          && (currentOpenedReaderCount % PRINT_INTERVAL == 0)) {
        logger.warn("Query has opened {} files !", readerMap.size());
      }

      TsFileSequenceReader tsFileReader = null;
      // check if the file is old version
      if (!isClosed) {
        tsFileReader = new UnClosedTsFileReader(filePath, ioSizeRecorder);
      } else {
        // already do the version check in TsFileSequenceReader's constructor
        tsFileReader = new TsFileSequenceReader(filePath, ioSizeRecorder);
      }
      readerMap.put(filePath, tsFileReader);
      return tsFileReader;
    }

    return readerMap.get(filePath);
  }
Get the reader of the file(tsfile or unseq tsfile) indicated by filePath. If the reader already
exists, just get it from closedFileReaderMap or unclosedFileReaderMap depending on isClosing .
Otherwise a new reader will be created and cached.

@param filePath the path of the file, of which the reader is desired.
@param isClosed whether the corresponding file still receives insertions or not.
@param ioSizeRecorder can be null
@return the reader of the file specified by filePath.
@throws IOException when reader cannot be created.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/control/FileReaderManager.java