viirya commented on a change in pull request #31888:
URL: https://github.com/apache/spark/pull/31888#discussion_r600259507



##########
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:
       Got it. Thanks for the reference.




-- 
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]

Reply via email to