Github user jiangxb1987 commented on a diff in the pull request:
https://github.com/apache/spark/pull/21639#discussion_r198188319
--- Diff: core/src/main/scala/org/apache/spark/TestUtils.scala ---
@@ -173,21 +173,23 @@ private[spark] object TestUtils {
* Run some code involving jobs submitted to the given context and
assert that the jobs spilled.
*/
def assertSpilled[T](sc: SparkContext, identifier: String)(body: => T):
Unit = {
- val spillListener = new SpillListener
- sc.addSparkListener(spillListener)
- body
- assert(spillListener.numSpilledStages > 0, s"expected $identifier to
spill, but did not")
+ withListener(sc, new SpillListener) { listener =>
+ val ret = body
--- End diff --
Maybe I'm missing something obvious, but why shall we need the return value
here?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]