@Override
  public void beforeStart(UDFParameters parameters, UDTFConfigurations configurations)
      throws Exception {
    configurations.setAccessStrategy(new RowByRowAccessStrategy()).setOutputDataType(Type.INT32);
    long gap = Util.parseTime(parameters.getStringOrDefault("gap", "0ms"), parameters);
    len = Util.parseTime(parameters.getString("length"), parameters);
    int count = gap == 0 ? 0 : (int) (len / gap + 1);
    consUtil = new ConsecutiveUtil(-gap, -gap, gap);
    consUtil.setCount(count);
  }
This function searches for consecutive subsequences of given length of input sereis.
library-udf/src/main/java/org/apache/iotdb/library/series/UDTFConsecutiveWindows.java