viirya commented on a change in pull request #31888:
URL: https://github.com/apache/spark/pull/31888#discussion_r598974589
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoderSuite.scala
##########
@@ -203,6 +203,36 @@ class ExpressionEncoderSuite extends
CodegenInterpretedPlanTest with AnalysisTes
encodeDecodeTest(Array(Option(InnerClass(1))), "array of optional inner
class")
+ // NOTE: branch-2.4 does not have the interpreted implementation of
SafeProjection, so
+ // it does not fall back into the interpreted mode if the compilation fails.
+ // Therefore, the test in this PR just checks that the compilation error
happens
+ // instead of checking that the interpreted mode works well.
+ private def checkCompilationError[T : ExpressionEncoder](
+ input: T,
+ testName: String): Unit = {
+ testAndVerifyNotLeakingReflectionObjects(s"compilation error: $testName:
$input") {
+ val encoder = implicitly[ExpressionEncoder[T]]
+ val row = encoder.toRow(input)
+ val boundEncoder = encoder.resolveAndBind()
+ val errMsg = intercept[RuntimeException] {
+ boundEncoder.fromRow(row)
+ }.getCause.getMessage
+ assert(errMsg.contains("failed to compile: "))
Review comment:
Is this the compilation error?
```
[info] Cause: org.codehaus.commons.compiler.CompileException: File
'generated.java', Line 32, Column 124: failed to compile:
org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 32,
Column 124: "org.apache.
spark.sql.catalyst.encoders.ExpressionEncoderSuite$MalformedClassObject$"
has no member type
"ExpressionEncoderSuite$MalformedClassObject$MalformedNameExample"
```
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]