private static FailureException toException(FragmentInstanceFailureInfo failureInfo) {
    if (failureInfo == null) {
      return null;
    }
    FailureException failure =
        new FailureException(failureInfo.getMessage(), toException(failureInfo.getCause()));
    for (FragmentInstanceFailureInfo suppressed : failureInfo.getSuppressed()) {
      failure.addSuppressed(toException(suppressed));
    }
    ImmutableList.Builder<StackTraceElement> stackTraceBuilder = ImmutableList.builder();
    for (String stack : failureInfo.getStack()) {
      stackTraceBuilder.add(toStackTraceElement(stack));
    }
    ImmutableList<StackTraceElement> stackTrace = stackTraceBuilder.build();
    failure.setStackTrace(stackTrace.toArray(new StackTraceElement[0]));
    return failure;
  }
This class is inspired by Trino <a
href="https://github.com/trinodb/trino/blob/master/core/trino-main/src/main/java/io/trino/execution/ExecutionFailureInfo.java">...</a>.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceFailureInfo.java