HeartSaVioR commented on code in PR #45937:
URL: https://github.com/apache/spark/pull/45937#discussion_r1561908874


##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/TransformWithListStateSuite.scala:
##########
@@ -307,7 +307,10 @@ class TransformWithListStateSuite extends StreamTest
         AddData(inputData, InputRow("k5", "append", "v4")),
         AddData(inputData, InputRow("k5", "put", "v5,v6")),
         AddData(inputData, InputRow("k5", "emitAllInState", "")),
-        CheckNewAnswer(("k5", "v5"), ("k5", "v6"))
+        CheckNewAnswer(("k5", "v5"), ("k5", "v6")),
+        Execute(q =>

Review Comment:
   nit: `{ q =>` while we are here and there are other nits



##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/TransformWithMapStateSuite.scala:
##########
@@ -214,7 +214,10 @@ class TransformWithMapStateSuite extends StreamTest
         AddData(inputData, InputMapRow("k2", "iterator", ("", ""))),
         CheckNewAnswer(),
         AddData(inputData, InputMapRow("k2", "exists", ("", ""))),
-        CheckNewAnswer(("k2", "exists", "false"))
+        CheckNewAnswer(("k2", "exists", "false")),
+        Execute(q =>

Review Comment:
   nit: same, `{ q =>`



##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/TransformWithValueStateTTLSuite.scala:
##########
@@ -243,7 +243,17 @@ class TransformWithValueStateTTLSuite
           CheckNewAnswer(),
           AddData(inputStream, InputEvent("k1", "get_values_in_ttl_state", 
-1)),
           AdvanceManualClock(1 * 1000),
-          CheckNewAnswer()
+          CheckNewAnswer(),
+          Execute(q => {

Review Comment:
   nit: same



##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/TransformWithStateSuite.scala:
##########
@@ -356,6 +356,10 @@ class TransformWithStateSuite extends StateStoreMetricsTest
       testStream(result, OutputMode.Update())(
         AddData(inputData, "a"),
         CheckNewAnswer(("a", "1")),
+        Execute(q => {

Review Comment:
   nit: `{ q =>` This is described in Spark Scala style guide to avoid 
unnecessary paren.



##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/TransformWithStateSuite.scala:
##########
@@ -518,7 +526,17 @@ class TransformWithStateSuite extends StateStoreMetricsTest
 
       AddData(inputData, ("b", 31)), // Add data newer than watermark for "b", 
not "a"
       // Watermark = 31 - 10 = 21, so "a" should be timed out as timeout 
timestamp for "a" is 20.
-      CheckNewAnswer(("a", -1), ("b", 31)) // State for "a" should timeout and 
emit -1
+      CheckNewAnswer(("a", -1), ("b", 31)), // State for "a" should timeout 
and emit -1
+      Execute(q => {

Review Comment:
   nit: same



##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/TransformWithStateSuite.scala:
##########
@@ -389,7 +393,10 @@ class TransformWithStateSuite extends StateStoreMetricsTest
         AddData(inputData, "a"),
         AdvanceManualClock(1 * 1000),
         CheckNewAnswer(("a", "1")),
-
+        Execute(q => {

Review Comment:
   nit: same



##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/TransformWithStateSuite.scala:
##########
@@ -518,7 +526,17 @@ class TransformWithStateSuite extends StateStoreMetricsTest
 
       AddData(inputData, ("b", 31)), // Add data newer than watermark for "b", 
not "a"
       // Watermark = 31 - 10 = 21, so "a" should be timed out as timeout 
timestamp for "a" is 20.
-      CheckNewAnswer(("a", -1), ("b", 31)) // State for "a" should timeout and 
emit -1
+      CheckNewAnswer(("a", -1), ("b", 31)), // State for "a" should timeout 
and emit -1
+      Execute(q => {
+        // Filter for idle progress events and then verify the custom metrics 
for stateful operator
+        val progData = q.recentProgress.filter(prog => 
prog.stateOperators.size > 0)
+        assert(progData.filter(prog =>

Review Comment:
   nit: probably { prog => and use one more line for } is much clearer to split 
out filter condition vs assert condition.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to