Ngone51 commented on a change in pull request #29050: URL: https://github.com/apache/spark/pull/29050#discussion_r452600574
########## File path: sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala ########## @@ -669,4 +671,30 @@ class UDFSuite extends QueryTest with SharedSparkSession { val df = Seq(Array(Some(TestData(50, "2")), None)).toDF("col") checkAnswer(df.select(myUdf(Column("col"))), Row(100) :: Nil) } + + object MalformedClassObject extends Serializable { + class MalformedNonPrimitiveFunction extends (String => Int) with Serializable { + override def apply(v1: String): Int = v1.toInt / 0 + } + + class MalformedPrimitiveFunction extends (Int => Int) with Serializable { + override def apply(v1: Int): Int = v1 / 0 + } + } + + test("SPARK-32238: Use Utils.getSimpleName to avoid hitting Malformed class name") { + OuterScopes.addOuterScope(MalformedClassObject) + val f1 = new MalformedClassObject.MalformedNonPrimitiveFunction() + val f2 = new MalformedClassObject.MalformedPrimitiveFunction() Review comment: It should be enough. But just want to improve test coverage on both non-primitive and primitive types for Scala UDF. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org