tdas commented on a change in pull request #27333: [SPARK-29438][SS][FOLLOWUP] 
Add regression tests for Streaming Aggregation and flatMapGroupsWithState
URL: https://github.com/apache/spark/pull/27333#discussion_r373323319
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingAggregationSuite.scala
 ##########
 @@ -316,6 +316,55 @@ class StreamingAggregationSuite extends 
StateStoreMetricsTest with Assertions {
     )
   }
 
+  testWithAllStateVersions("SPARK-29438: ensure UNION doesn't lead streaming 
aggregation to use" +
+    " shifted partition IDs") {
+    def constructUnionDf(desiredPartitionsForInput1: Int)
+      : (MemoryStream[Int], MemoryStream[Int], DataFrame) = {
+      val input1 = MemoryStream[Int](desiredPartitionsForInput1)
+      val input2 = MemoryStream[Int]
+      val df1 = input1.toDF()
+        .select($"value", $"value" + 1, $"value" + 2)
+      val df2 = input2.toDF()
+        .groupBy($"value", $"value" + 1)
+        .agg(count("*"))
+
+      // Unioned DF would have columns as (Int, Int, Int)
+      (input1, input2, df1.union(df2))
+    }
+
+    withTempDir { checkpointDir =>
+      val (input1, input2, unionDf) = constructUnionDf(2)
+      testStream(unionDf, Update)(
+        StartStream(checkpointLocation = checkpointDir.getAbsolutePath),
+        MultiAddData(
+          (input1, Seq(11, 12)),
 
 Review comment:
   same comment as above, make the input space of the two inputs distinct so 
that it's more obvious which output came from where.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to