public static AbstractAlignedTimeSeriesMetadata loadAlignedTimeSeriesMetadata(
      TsFileResource resource,
      AlignedFullPath alignedPath,
      FragmentInstanceContext context,
      Filter globalTimeFilter,
      boolean isSeq,
      boolean ignoreAllNullRows)
      throws IOException {
    final long t1 = System.nanoTime();
    boolean loadFromMem = false;
    try {
      AbstractAlignedTimeSeriesMetadata alignedTimeSeriesMetadata;
      // If the tsfile is closed, we need to load from tsfile
      if (resource.isClosed()) {
        alignedTimeSeriesMetadata =
            loadAlignedTimeSeriesMetadataFromDisk(
                resource, alignedPath, context, globalTimeFilter, ignoreAllNullRows);
      } else { // if the tsfile is unclosed, we just get it directly from TsFileResource
        loadFromMem = true;
        alignedTimeSeriesMetadata =
            (AbstractAlignedTimeSeriesMetadata) resource.getTimeSeriesMetadata(alignedPath);
        if (alignedTimeSeriesMetadata != null) {
          alignedTimeSeriesMetadata.setChunkMetadataLoader(
              new MemAlignedChunkMetadataLoader(
                  resource, alignedPath, context, globalTimeFilter, ignoreAllNullRows));
          // mem's modification already done in generating chunkmetadata
        }
      }

      if (alignedTimeSeriesMetadata != null) {
        if (alignedTimeSeriesMetadata.getTimeseriesMetadata().getStatistics().getStartTime()
            > alignedTimeSeriesMetadata.getTimeseriesMetadata().getStatistics().getEndTime()) {
          return null;
        }
        if (globalTimeFilter != null && globalTimeFilter.canSkip(alignedTimeSeriesMetadata)) {
          return null;
        }
      }
      return alignedTimeSeriesMetadata;
    } finally {
      long costTime = System.nanoTime() - t1;
      if (loadFromMem) {
        if (isSeq) {
          context.getQueryStatistics().getLoadTimeSeriesMetadataAlignedMemSeqCount().getAndAdd(1);
          context
              .getQueryStatistics()
              .getLoadTimeSeriesMetadataAlignedMemSeqTime()
              .getAndAdd(costTime);
        } else {
          context.getQueryStatistics().getLoadTimeSeriesMetadataAlignedMemUnSeqCount().getAndAdd(1);
          context
              .getQueryStatistics()
              .getLoadTimeSeriesMetadataAlignedMemUnSeqTime()
              .getAndAdd(costTime);
        }
      } else {
        if (isSeq) {
          context.getQueryStatistics().getLoadTimeSeriesMetadataAlignedDiskSeqCount().getAndAdd(1);
          context
              .getQueryStatistics()
              .getLoadTimeSeriesMetadataAlignedDiskSeqTime()
              .getAndAdd(costTime);
        } else {
          context
              .getQueryStatistics()
              .getLoadTimeSeriesMetadataAlignedDiskUnSeqCount()
              .getAndAdd(1);
          context
              .getQueryStatistics()
              .getLoadTimeSeriesMetadataAlignedDiskUnSeqTime()
              .getAndAdd(costTime);
        }
      }
    }
  }
Load AlignedTimeSeriesMetadata for aligned time series.

@param resource corresponding TsFileResource
@param alignedPath instance of VectorPartialPath, vector's full path, e.g. (root.sg1.d1.vector,
    [root.sg1.d1.vector.s1, root.sg1.d1.vector.s2])
@throws IOException IOException may be thrown while reading it from disk.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/FileLoaderUtils.java