@Override
  public void terminate(PointCollector collector) throws Exception {
    if (consUtil.getGap() == 0) {
      consUtil.calculateGap();
      consUtil.cleanWindow(collector);
    }
    if (consUtil.getCount() > 1) {
      collector.putInt(consUtil.getFirst(), consUtil.getCount());
    }
  }
This function searches for all longest consecutive subsequences of input sereis.
library-udf/src/main/java/org/apache/iotdb/library/series/UDTFConsecutiveSequences.java