Github user mgaido91 commented on a diff in the pull request: https://github.com/apache/spark/pull/20773#discussion_r173217810 --- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/MiscExpressionsSuite.scala --- @@ -47,18 +47,24 @@ class MiscExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper { } test("PrintToStderr") { - val errorStream = new java.io.ByteArrayOutputStream() - val systemErr = System.err - System.setErr(new PrintStream(errorStream)) val inputExpr = Literal(1) - // check without codegen - checkEvaluationWithoutCodegen(PrintToStderr(inputExpr), 1) - val outputEval = errorStream.toString - errorStream.reset() - // check with codegen - checkEvaluationWithoutCodegen(PrintToStderr(inputExpr), 1) - val outputCodegen = errorStream.toString - System.setErr(systemErr) + val systemErr = System.err + + val (outputEval, outputCodegen) = try { + val errorStream = new java.io.ByteArrayOutputStream() + System.setErr(new PrintStream(errorStream)) + // check without codegen + checkEvaluationWithoutCodegen(PrintToStderr(inputExpr), 1) + val outputEval = errorStream.toString + errorStream.reset() + // check with codegen + checkEvaluationWithoutCodegen(PrintToStderr(inputExpr), 1) --- End diff -- yes, sorry, my bad
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org