Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/20773#discussion_r173216739
--- 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 --
`checkEvaluationWithoutCodegen`? Shouldn't we use
`checkEvaluationWithUnsafeProjection` or
`checkEvaluationWithGeneratedMutableProjection`?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]