Github user wuchong commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2792#discussion_r87693746
  
    --- Diff: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/api/scala/stream/table/AggregationsITCase.scala
 ---
    @@ -177,6 +177,58 @@ class AggregationsITCase extends 
StreamingMultipleProgramsTestBase {
           "Hi,1,1970-01-01 00:00:00.0,1970-01-01 00:00:00.01,1970-01-01 
00:00:00.0")
         assertEquals(expected.sorted, StreamITCase.testResults.sorted)
       }
    +
    +  @Test
    +  def testProcessingTimeSlidingGroupWindowOverCountWithAVG(): Unit = {
    +    val env = StreamExecutionEnvironment.getExecutionEnvironment
    +    env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
    +    val tEnv = TableEnvironment.getTableEnvironment(env)
    +    StreamITCase.testResults = mutable.MutableList()
    +
    +    val stream = env.fromCollection(data)
    +    val table = stream.toTable(tEnv, 'long, 'int, 'string)
    +
    +    val windowedTable = table
    +      .groupBy('string)
    +      .window(Slide over 4.rows every 2.rows)
    +      .select('string, 'int.avg)
    +
    +    val results = windowedTable.toDataStream[Row]
    +    results.addSink(new StreamITCase.StringSink)
    +    env.execute()
    +
    +    val expected = Seq("Hello world,3","Hello,2")
    +    assertEquals(expected.sorted, StreamITCase.testResults.sorted)
    +  }
    +
    +  @Test
    +  def testEventTimeTumblingWindowWithAVG(): Unit = {
    +    val env = StreamExecutionEnvironment.getExecutionEnvironment
    +    env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
    +    val tEnv = TableEnvironment.getTableEnvironment(env)
    +    StreamITCase.testResults = mutable.MutableList()
    +
    +    val stream = env
    +      .fromCollection(data)
    +      .assignTimestampsAndWatermarks(new TimestampWithEqualWatermark())
    +    val table = stream.toTable(tEnv, 'long, 'int, 'string)
    +
    +    val windowedTable = table
    +      .groupBy('string)
    +      .window(Tumble over 5.milli on 'rowtime as 'w)
    +      .select('string, 'int.avg)
    --- End diff --
    
    Same as above. It could be combined with `testEventTimeTumblingWindow` , 
and reduce the test number. 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to