beyond1920 commented on a change in pull request #16215:
URL: https://github.com/apache/flink/pull/16215#discussion_r661091381



##########
File path: 
flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/WindowAggregateITCase.scala
##########
@@ -206,6 +206,98 @@ class WindowAggregateITCase(
     assertEquals(expected.sorted.mkString("\n"), 
sink.getAppendResults.sorted.mkString("\n"))
   }
 
+  @Test
+  def testEventTimeTumbleWindowWithOffset(): Unit = {
+    val sql =
+      """
+        |SELECT
+        |  `name`,
+        |  window_start,
+        |  window_end,
+        |  COUNT(*),
+        |  SUM(`bigdec`),
+        |  MAX(`double`),
+        |  MIN(`float`),
+        |  COUNT(DISTINCT `string`),
+        |  concat_distinct_agg(`string`)
+        |FROM TABLE(
+        |   TUMBLE(TABLE T1, DESCRIPTOR(rowtime), INTERVAL '1' DAY, INTERVAL 
'8' HOUR))
+        |GROUP BY `name`, window_start, window_end
+      """.stripMargin
+
+    val sink = new TestingAppendSink
+    tEnv.sqlQuery(sql).toAppendStream[Row].addSink(sink)
+    env.execute()
+
+    val expected = Seq(
+      
"a,2020-10-09T08:00,2020-10-10T08:00,6,19.98,5.0,1.0,3,Hi|Comment#1|Comment#2",

Review comment:
       Timestamp of all records with `name` = 'a'  are [2020-10-10T00:00:01, 
2020-10-10T00:00:02, 2020-10-10T00:00:03,  2020-10-10T00:00:04, 
2020-10-10T00:00:08, 2020-10-10T00:00:04] .
   In this case, offset is 8 hour means window region at [08:00:00, T+1 
08:00:00) instead of [00:00:00, 24:00:00) at each day. Based on this rule, 
above records with `name` = 'a' all belongs to [2020-10-09 08:00:00,2020-10-10 
08:00:00), right?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to