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

    https://github.com/apache/flink/pull/3629#discussion_r108470934
  
    --- Diff: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/scala/stream/sql/SqlITCase.scala
 ---
    @@ -411,6 +411,128 @@ class SqlITCase extends StreamingWithStateTestBase {
         assertEquals(expected.sorted, StreamITCase.testResults.sorted)
       }
     
    +  @Test
    +  def testBoundPartitionedEventTimeWindowWithRange(): Unit = {
    +    val data = Seq(
    +      Left((1000L, (1L, 1, "Hello"))),
    +      Left((1000L, (1L, 1, "Hello"))),
    +      Left((1000L, (1L, 1, "Hello"))),
    +      Left((2000L, (2L, 2, "Hello"))),
    +      Right(1000L),
    +      Left((2000L, (2L, 2, "Hello"))),
    +      Left((2000L, (2L, 2, "Hello"))),
    +      Left((3000L, (3L, 3, "Hello"))),
    +      Right(2000L),
    +      Left((4000L, (4L, 4, "Hello"))),
    +      Right(3000L),
    +      Left((5000L, (5L, 5, "Hello"))),
    +      Right(5000L),
    +      Left((6000L, (6L, 6, "Hello"))),
    +      Right(7000L),
    +      Left((8000L, (7L, 7, "Hello World"))),
    +      Left((8000L, (7L, 7, "Hello World"))),
    +      Left((10000L, (7L, 7, "Hello World"))),
    +      Right(8000L),
    +      Left((12000L, (7L, 7, "Hello World"))),
    +      Right(9000L),
    +      Left((13000L, (8L, 8, "Hello World"))),
    +      Right(11000L),
    +      Left((20000L, (20L, 20, "Hello World"))),
    +      Right(19000L))
    +
    +    val env = StreamExecutionEnvironment.getExecutionEnvironment
    +    env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)
    +    env.setStateBackend(getStateBackend)
    +    val tEnv = TableEnvironment.getTableEnvironment(env)
    +    StreamITCase.clear
    +
    +    val t1 = env
    +      .addSource[(Long, Int, String)](new EventTimeSourceFunction[(Long, 
Int, String)](data))
    +      .toTable(tEnv).as('a, 'b, 'c)
    +
    +    tEnv.registerTable("T1", t1)
    +
    +    val sqlQuery = "SELECT " +
    +      "c, a, " +
    +      "count(a) OVER (PARTITION BY c ORDER BY RowTime() RANGE BETWEEN 
INTERVAL '1' SECOND " +
    +      "preceding AND CURRENT ROW)" +
    +      ", sum(a) OVER (PARTITION BY c ORDER BY RowTime() RANGE BETWEEN 
INTERVAL '1' SECOND " +
    +      " preceding AND CURRENT ROW)" +
    +      " from T1"
    +
    +    val result = tEnv.sql(sqlQuery).toDataStream[Row]
    +    result.addSink(new StreamITCase.StringSink)
    +    env.execute()
    +
    +    val expected = mutable.MutableList(
    +      "Hello,1,3,3", "Hello,1,3,3", "Hello,1,3,3",
    +      "Hello,2,6,9", "Hello,2,6,9","Hello,2,6,9",
    +      "Hello,3,4,9",
    +      "Hello,4,2,7",
    +      "Hello,5,2,9",
    +      "Hello,6,2,11",
    +      "Hello World,7,2,14", "Hello World,7,2,14", "Hello World,7,1,7", 
"Hello World,7,1,7",
    +      "Hello World,8,2,15",
    +      "Hello World,20,1,20")
    +    assertEquals(expected.sorted, StreamITCase.testResults.sorted)
    +  }
    +
    +  @Test
    +  def testBoundNonPartitionedEventTimeWindowWithRange(): Unit = {
    +    val data = Seq(
    +      Left((1000L, (1L, 1, "Hello"))),
    --- End diff --
    
    Please cover more corner cases with the test data (see above).


---
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