@Override
  public void transform(Row row, PointCollector collector) throws Exception {
    long nowTime = row.getTime();
    double nowValue = Util.getValueAsDouble(row);
    if (startTime < 0) {
      startTime = nowTime;
    }
    if (Double.isFinite(nowValue)) {
      // calculate the ladder-shaped area between last point and this one
      // skip and initialize the memory if no existing previous point is available
      if (lastTime >= 0) {
        integralValue += (lastValue + nowValue) * (nowTime - lastTime) / 2.0;
      }
      lastTime = nowTime;
      lastValue = nowValue;
    }
  }
calculate the integral or the area under the curve of input series $unit$ is the time scale for
the area calculation, chosen from 1s(second, default), 1m(minute), 1h(hour), 1d(day).
library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDAFIntegralAvg.java