@Override
  public void validate(UDFParameterValidator validator) throws Exception {
    validator
        .validateInputSeriesNumber(1)
        .validate(
            k -> (int) k > 0,
            "k should be a positive integer.",
            validator.getParameters().getIntOrDefault("k", 1))
        .validate(
            method ->
                "isometric".equalsIgnoreCase((String) method)
                    || METHOD_RESERVOIR.equalsIgnoreCase((String) method)
                    || "triangle".equalsIgnoreCase((String) method),
            "Illegal sampling method.",
            validator.getParameters().getStringOrDefault("method", METHOD_RESERVOIR));
  }
This function samples data by pool sampling.
library-udf/src/main/java/org/apache/iotdb/library/dprofile/UDTFSample.java