@Override
  public void transform(RowWindow rowWindow, PointCollector collector) throws Exception {
    WindowDetect wd = new WindowDetect(rowWindow.getRowIterator(), len, threshold);
    double[] repaired = wd.getRepaired();
    long[] time = wd.getTime();
    switch (rowWindow.getDataType(0)) {
      case DOUBLE:
        for (int i = 0; i < time.length; i++) {
          collector.putDouble(time[i], repaired[i]);
        }
        break;
      case FLOAT:
        for (int i = 0; i < time.length; i++) {
          collector.putFloat(time[i], (float) repaired[i]);
        }
        break;
      case INT32:
        for (int i = 0; i < time.length; i++) {
          collector.putInt(time[i], (int) Math.round(repaired[i]));
        }
        break;
      case INT64:
        for (int i = 0; i < time.length; i++) {
          collector.putLong(time[i], Math.round(repaired[i]));
        }
        break;
      case BOOLEAN:
      case BLOB:
      case STRING:
      case TEXT:
      case TIMESTAMP:
      case DATE:
      default:
        throw new UDFException("No such kind of data type.");
    }
  }
The function is used to filter anomalies of a numeric time series based on two-sided window
detection.
library-udf/src/main/java/org/apache/iotdb/library/anomaly/UDTFTwoSidedFilter.java