@Override
  public void terminate(PointCollector collector) throws Exception {
    if (exact) {
      collector.putDouble(0, statistics.getMad());
    } else {
      collector.putDouble(0, sketch.getMad().result);
    }
  }
calculate the exact or approximate median absolute deviation (mad).
library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDAFMad.java