public static TSStatus getPriorStatus(final List<TSStatus> givenStatusList) {
    final TSStatus resultStatus = new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
    for (final TSStatus givenStatus : givenStatusList) {
      if (!STATUS_PRIORITY.contains(givenStatus.getCode())) {
        return givenStatus;
      }

      if (STATUS_PRIORITY.indexOf(givenStatus.getCode())
          > STATUS_PRIORITY.indexOf(resultStatus.getCode())) {
        resultStatus.setCode(givenStatus.getCode());
      }
    }
    resultStatus.setSubStatus(givenStatusList);
    return resultStatus;
  }
This method is used to get the highest priority {@link TSStatus} from a list of {@link
TSStatus}. The priority of each status is determined by its {@link TSStatusCode}, and the
priority sequence is defined in the {@link #STATUS_PRIORITY} list.

<p>Specifically, it iterates through the input {@link TSStatus} list. For each {@link
TSStatus}, if its {@link TSStatusCode} is not in the {@link #STATUS_PRIORITY} list, it directly
returns this {@link TSStatus}. Otherwise, it compares the current {@link TSStatus} with the
highest priority {@link TSStatus} found so far (initially set to the {@link
TSStatusCode#SUCCESS_STATUS}). If the current {@link TSStatus} has a higher priority, it
updates the highest priority {@link TSStatus} to the current {@link TSStatus}.

<p>Finally, the method returns the highest priority {@link TSStatus}.

@param givenStatusList a list of {@link TSStatus} from which the highest priority {@link
    TSStatus} is to be found
@return the highest priority {@link TSStatus} from the input list
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/receiver/PipeReceiverStatusHandler.java