HyukjinKwon commented on code in PR #36261: URL: https://github.com/apache/spark/pull/36261#discussion_r853658325
########## sql/core/src/test/scala/org/apache/spark/sql/execution/python/PythonForeachWriterSuite.scala: ########## @@ -102,11 +102,15 @@ class PythonForeachWriterSuite extends SparkFunSuite with Eventually with Mockit private val intProj = UnsafeProjection.create(Array[DataType](IntegerType)) private val thread = new Thread() { override def run(): Unit = { - while (iterator.hasNext) { - outputBuffer.synchronized { - outputBuffer += iterator.next().getInt(0) + try { + while (iterator.hasNext) { + outputBuffer.synchronized { + outputBuffer += iterator.next().getInt(0) + } + Thread.sleep(sleepPerRowReadMs) } - Thread.sleep(sleepPerRowReadMs) + } catch { + case _: InterruptedException => buffer.close() Review Comment: can we put this in `finally`? -- 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