@Override
  public void validate(UDFParameterValidator validator) throws Exception {

    validator
        .validateInputSeriesNumber(1)
        .validateInputSeriesDataType(0, Type.DOUBLE, Type.FLOAT, Type.INT32, Type.INT64)
        .validate(
            x -> (long) x > 0,
            "gap should be a time period whose unit is ms, s, m, h, d.",
            Util.parseTime(validator.getParameters().getString("every"), validator.getParameters()))
        .validate(
            x ->
                "min".equals(x)
                    || "max".equals(x)
                    || "mean".equals(x)
                    || "median".equals(x)
                    || "first".equals(x)
                    || "last".equals(x),
            "aggr should be min, max, mean, median, first, last.",
            validator.getParameters().getStringOrDefault("aggr", "mean").toLowerCase())
        .validate(
            x -> "nan".equals(x) || "ffill".equals(x) || "bfill".equals(x) || "linear".equals(x),
            "aggr should be min, max, mean, median, first, last.",
            validator.getParameters().getStringOrDefault("interp", "nan").toLowerCase());
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    if (validator.getParameters().hasAttribute(START_PARAM)) {
      validator.validate(
          x -> (long) x > 0,
          "start should conform to the format yyyy-MM-dd HH:mm:ss.",
          format.parse(validator.getParameters().getString(START_PARAM)).getTime());
    }
    if (validator.getParameters().hasAttribute("end")) {
      validator.validate(
          x -> (long) x > 0,
          "end should conform to the format yyyy-MM-dd HH:mm:ss.",
          format.parse(validator.getParameters().getString("end")).getTime());
    }
  }
This function does upsample or downsample of input series.
library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDTFResample.java