@Override
  public void transform(Row row, PointCollector collector) throws Exception {
    long t = row.getTime();
    double windowSum = 0d;
    if (v.isFull()) {
      windowSum -= v.pop();
    }
    double value = Util.getValueAsDouble(row);
    if (Double.isFinite(value)) {
      v.push(value);
      windowSum += value;
      if (v.isFull()) {
        collector.putDouble(t, windowSum / windowSize);
      }
    }
  }
This function calculates moving average of given window length of input series.
library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDTFMvAvg.java