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_r248928746
 
 

 ##########
 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
 
 Review comment:
   Now I see you're adding current states in other test. It would be ideal we 
have similar level of explanation here.

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