public TFetchFragmentInstanceStatisticsResp getFragmentInstanceStatistics(
      FragmentInstanceId instanceId) {
    requireNonNull(instanceId, "instanceId is null");
    // If the instance is still running, we directly get the statistics from instanceExecution
    FragmentInstanceExecution fragmentInstanceExecution = instanceExecution.get(instanceId);
    if (fragmentInstanceExecution != null) {
      try {
        fragmentInstanceExecution.lockStatistics();
        if (!fragmentInstanceExecution.isStaticsRemoved()) {
          return fragmentInstanceExecution.buildStatistics();
        }
      } finally {
        fragmentInstanceExecution.unlockStatistics();
      }
    }
    // If the instance has finished, we get the statistics which was cached in the instanceContext
    // when instanceExecution was removed.
    FragmentInstanceContext context = instanceContext.get(instanceId);
    if (context == null) {
      return new TFetchFragmentInstanceStatisticsResp();
    }
    TFetchFragmentInstanceStatisticsResp statisticsResp = context.getFragmentInstanceStatistics();
    return statisticsResp == null ? new TFetchFragmentInstanceStatisticsResp() : statisticsResp;
  }
Gets the info for the specified fragment instance.

<p>NOTE: this design assumes that only fragment instances that will eventually exist are
queried.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceManager.java