HeartSaVioR commented on a change in pull request #23576: [SPARK-26655] [SS] 
Support multiple aggregates in append mode
URL: https://github.com/apache/spark/pull/23576#discussion_r249046819
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/streaming/EventTimeWatermarkSuite.scala
 ##########
 @@ -302,6 +302,71 @@ class EventTimeWatermarkSuite extends StreamTest with 
BeforeAndAfter with Matche
     )
   }
 
+  test("multiple aggregates in append mode") {
+    val inputData = MemoryStream[Int]
+
+    val windowedAggregation = inputData.toDF()
+      .withColumn("inputtime", $"value".cast("timestamp"))
+      .withWatermark("inputtime", "10 seconds")
+      .groupBy(window($"inputtime", "5 seconds") as 'window1, 
$"inputtime").count()
+      .select($"window1.end".as("windowtime"), $"count".as("num"))
+      .withWatermark("windowtime", "5 seconds")
+      .groupBy(window($"windowtime", "5 seconds") as 'window2, $"num").count()
+      .select($"window2.start".cast("long").as[Long], $"num", $"count")
+
+    testStream(windowedAggregation)(
+      AddData(inputData, 10, 11, 11, 12, 12),
+      CheckNewAnswer(),
+      AddData(inputData, 25), // watermark -> group1 = 15, group2 = 10
+      CheckNewAnswer(),
+      assertNumTotalStateRows(3),
+      AddData(inputData, 26, 26, 27),
+      CheckNewAnswer(),
+      AddData(inputData, 40), // watermark -> group1 = 30 , group2 = 25
+      CheckNewAnswer((15, 1, 1), (15, 2, 2))
+    )
+  }
+
+  test("multiple aggregates in append mode recovery") {
+    val inputData = MemoryStream[Int]
+
+    val windowedAggregation = inputData.toDF()
 
 Review comment:
   Same here: I would ask to change query.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to