@Override
  public void transform(Row row, PointCollector pc) throws Exception {
    resampler.insert(row.getTime(), Util.getValueAsDouble(row));
    while (resampler.hasNext()) { // output as early as possible
      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