Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-19604 FLIP-145: Support SQL windowing table-valued function
  3. FLINK-21305

Fix Cumulative and Hopping window should accumulate late events belonging to the cleaned slice

    XMLWordPrintableJSON

Details

    Description

      Currently, the CUMULATE window drops elements belonging to the cleaned slices. This will lead to more inaccurate result than without slicing optimization.

      Hopping window has the similar problem, you can reproduce the problem with the following test in WindowAggregateJsonITCase.

          @Test
          public void testEventTimeHopWindow2() throws Exception {
              createTestValuesSinkTable("MySink", "name STRING", "cnt BIGINT");
              String jsonPlan =
                      tableEnv.getJsonPlan(
                              "insert into MySink select\n"
                                      + "  name,\n"
                                      + "  COUNT(*)\n"
                                      + "FROM TABLE(\n"
                                      + "   HOP(TABLE MyTable, DESCRIPTOR(rowtime), INTERVAL '5' SECOND, INTERVAL '10' SECOND))\n"
                                      + "GROUP BY name, window_start, window_end");
              tableEnv.executeJsonPlan(jsonPlan).await();
      
              List<String> result = TestValuesTableFactory.getResults("MySink");
              assertResult(
                      Arrays.asList(
                              "+I[a, 1]",
                              "+I[a, 4]",
                              "+I[a, 6]",
                              "+I[b, 1]",
                              "+I[b, 1]",
                              "+I[b, 1]",
                              "+I[b, 1]",
                              "+I[b, 2]",
                              "+I[b, 2]",
                              "+I[null, 1]",
                              "+I[null, 1]"),
                      result);
          }
      

      Attachments

        Issue Links

          Activity

            People

              jark Jark Wu
              jark Jark Wu
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: