@Override
  public void terminate(PointCollector collector) throws Exception {
    if (compute.equalsIgnoreCase(BATCH_COMPUTE)) {
      avg = sum / value.size();
      sd = Math.sqrt(squareSum / value.size() - avg * avg);
      for (int i = 0; i < value.size(); i++) {
        collector.putDouble(timestamp.get(i), (value.get(i) - avg) / sd);
      }
    }
  }
This function is used to standardize the input series with z-score. Stream swap require user to
provide average and stddev, while global swap does not.
library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDTFZScore.java