public void serialize(DataOutputStream outputStream) throws IOException {
    ReadWriteIOUtils.write(message, outputStream);
    if (cause == null) {
      ReadWriteIOUtils.write(0, outputStream);
    } else {
      ReadWriteIOUtils.write(1, outputStream);
      cause.serialize(outputStream);
    }
    ReadWriteIOUtils.write(suppressed.size(), outputStream);
    for (FragmentInstanceFailureInfo failureInfo : suppressed) {
      failureInfo.serialize(outputStream);
    }
    ReadWriteIOUtils.write(stack.size(), outputStream);
    for (String s : stack) {
      ReadWriteIOUtils.write(s, outputStream);
    }
  }
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