@Override
  public void transform(RowWindow rowWindow, PointCollector collector) throws Exception {
    DoubleArrayList value = new DoubleArrayList();
    RowIterator iterator = rowWindow.getRowIterator();
    while (iterator.hasNextRow()) {
      Row row = iterator.next();
      double v = Util.getValueAsDouble(row);
      if (Double.isFinite(v)) {
        value.add(v);
      } else {
        value.add(value.getLast());
      }
    }
    double[] corr = autoCorrelation(value.toArray());
    int[] peeks = findPeeks(corr).toArray();
    int period = 0;
    if (peeks.length > 1) {
      int[] gap = Util.variation(peeks);
      period = (int) new IntArrayList(gap).median();
    }
    collector.putInt(0, period);
  }
The function is used to compute the period of a numeric time series.
library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDAFPeriod.java