Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/3589#discussion_r108792441
--- Diff:
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/runtime/dataset/DataSetWindowAggregateITCase.scala
---
@@ -354,4 +354,94 @@ class DataSetWindowAggregateITCase(
val results = windowedTable.toDataSet[Row].collect()
TestBaseUtils.compareResultAsText(results.asJava, expected)
}
+
+ @Test
+ def testEventTimeSlidingGroupWindowOverCountOverlappingFullPane(): Unit
= {
+ // please keep this test in sync with the DataStream processing-time
variant
+ val env = ExecutionEnvironment.getExecutionEnvironment
+ val tEnv = TableEnvironment.getTableEnvironment(env)
+
+ val table = env
+ .fromCollection(data)
+ .toTable(tEnv, 'long, 'int, 'double, 'float, 'bigdec, 'string)
+
+ val windowedTable = table
+ .window(Slide over 4.rows every 2.rows on 'long as 'w)
+ .groupBy('string, 'w)
+ .select('string, 'int.count)
+
+ val expected =
+ "Hello world,2\n" +
+ "Hello,2"
+
+ val results = windowedTable.toDataSet[Row].collect()
+ TestBaseUtils.compareResultAsText(results.asJava, expected)
+ }
+
+ @Test
+ def testEventTimeSlidingGroupWindowOverCountOverlappingSplitPane(): Unit
= {
+ // please keep this test in sync with the DataStream processing-time
variant
+ val env = ExecutionEnvironment.getExecutionEnvironment
+ val tEnv = TableEnvironment.getTableEnvironment(env)
+
+ val table = env
+ .fromCollection(data)
+ .toTable(tEnv, 'long, 'int, 'double, 'float, 'bigdec, 'string)
+
+ val windowedTable = table
+ .window(Slide over 6.rows every 1.rows on 'long as 'w)
+ .groupBy('w, 'string)
+ .select('string, 'int.count)
+
+ val expected = "Hallo,1\n" +
+ "Hello world,1\n" +
+ "Hello world,2\n" +
+ "Hello,1\n" +
+ "Hello,2\n" +
+ "Hello,3\n" +
+ "Hi,1"
+
+ val results = windowedTable.toDataSet[Row].collect()
+ TestBaseUtils.compareResultAsText(results.asJava, expected)
+ }
+
+ @Test
+ def testEventTimeSlidingGroupWindowOverCountNonOverlappingFullPane():
Unit = {
+ // please keep this test in sync with the DataStream processing-time
variant
+ val env = ExecutionEnvironment.getExecutionEnvironment
+ val tEnv = TableEnvironment.getTableEnvironment(env)
+
+ val table = env
+ .fromCollection(data)
+ .toTable(tEnv, 'long, 'int, 'double, 'float, 'bigdec, 'string)
+
+ val windowedTable = table
+ .window(Slide over 2.rows every 4.rows on 'long as 'w)
+ .groupBy('string, 'w)
+ .select('string, 'int.count)
+
+ val results = windowedTable.toDataSet[Row].collect()
+ Assert.assertEquals(0, results.length)
--- End diff --
I think we should choose a data set that actually returns a result that can
be checked. An empty result could be caused by many things.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---