title: How to make the sliding window in Apache Flink to slide only after the window size is reached?
body: <p>private DataStream buySideVolumeWMA(DataStream buyPressureTradeStream) {</p>
  
  <pre><code>    Integer windowSize = 3;
      Integer windowslide = 1;
  
      DataStream&lt;Double&gt; buySideVolumeWMAStream = buyPressureTradeStream.countWindowAll(windowSize, windowslide)
              .apply(new AllWindowFunction&lt;String, Double, GlobalWindow&gt;() {
  
                  @Override
                  public void apply(GlobalWindow window, Iterable&lt;String&gt; values, Collector&lt;Double&gt; out)
                          throws Exception {
                      Double buySideVolumeWMA = 0.0;
                      Integer weight = windowSize;
                      Integer numerator = 1;
  
                      for (String tradeString : values) {
                          JSONObject json = new JSONObject(tradeString);
                          Double tradeVolume = (Double) json.get("Volume");
                          buySideVolumeWMA += ((tradeVolume * numerator) / weight);
                          slf4jLogger.info("tradeVolume " + tradeVolume + " , " + "numerator , " + numerator
                                  + " weight , " + weight + " buySideVolumeWMA " + buySideVolumeWMA);
                          numerator++;
  
                      }
                      numerator = 1;
  
                      out.collect(buySideVolumeWMA / 2);
                      buySideVolumePressure = buySideVolumeWMA / 2;
                      // slf4jLogger.info("buySideVolumePressure :" +
                      // buySideVolumePressure);
  
  
      buySideVolumeWMAStream.print().setParallelism(5);
  
      return buySideVolumeWMAStream;
  
  }
  </code></pre>
  
  <p>========================================================================       In this program I am using a window size of 3 and slide size 1. I want it to start sliding once it receives streaming data of count 3 and then only start slide by 1. But what happens is that my program start to slide immediately as it receives first data and then it slides for every single data it receives.So how to make it slide only after it receive data of count 3 and then slide by 1? </p>