public static StackTraceElement toStackTraceElement(String stack) {
    Matcher matcher = STACK_TRACE_PATTERN.matcher(stack);
    if (matcher.matches()) {
      String declaringClass = matcher.group(1);
      String methodName = matcher.group(2);
      String fileName = matcher.group(3);
      int number = -1;
      if (fileName.equals("Native Method")) {
        fileName = null;
        number = -2;
      } else if (matcher.group(4) != null) {
        number = Integer.parseInt(matcher.group(4));
      }
      return new StackTraceElement(declaringClass, methodName, fileName, number);
    }
    return new StackTraceElement("Unknown", stack, null, -1);
  }
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