anishshri-db commented on code in PR #50795: URL: https://github.com/apache/spark/pull/50795#discussion_r2074487223
########## sql/core/src/test/scala/org/apache/spark/sql/execution/streaming/sources/ForeachBatchSinkSuite.scala: ########## @@ -254,6 +254,23 @@ class ForeachBatchSinkSuite extends StreamTest { query.awaitTermination() } + test("SPARK-52008: foreachBatch that doesn't consume entire iterator") { + val mem = MemoryStream[Int] + val ds = mem.toDS().map(_ + 1) + mem.addData(1, 2, 3, 4, 5) + + val queryEx = intercept[StreamingQueryException] { + val query = ds.writeStream.foreachBatch( + (batchDf: Dataset[Int], _: Long) => batchDf.show(2)).start() + query.awaitTermination() + } + + val errClass = "STATE_STORE_UPDATING_AFTER_TASK_COMPLETION" + + // verify that we classified the exception + assert(queryEx.getMessage.contains(errClass)) Review Comment: Can we use `checkError` instead ? -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org