@Override
  public void terminate(PointCollector pc) throws Exception {
    resampler.flush();
    while (resampler.hasNext()) {
      pc.putDouble(resampler.getOutTime(), resampler.getOutValue());
      resampler.next();
    }
  }
This function does upsample or downsample of input series.
library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDTFResample.java