This is an automated email from the ASF dual-hosted git repository. dongjoon pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new 4ef535ff Revert "[SPARK-32307][SQL] ScalaUDF's canonicalized expression should exclude inputEncoders" 4ef535ff is described below commit 4ef535fffbc1cacbacb035b2b1ac1dffcc0352b4 Author: Dongjoon Hyun <dongj...@apache.org> AuthorDate: Wed Jul 15 17:43:23 2020 -0700 Revert "[SPARK-32307][SQL] ScalaUDF's canonicalized expression should exclude inputEncoders" This reverts commit 785ec2ee6c2473f54b7ca6c01f446cc8bdf883fa. --- .../org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala | 6 ------ sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala | 12 ------------ 2 files changed, 18 deletions(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala index 2706e4d..58a9f68 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala @@ -57,12 +57,6 @@ case class ScalaUDF( override def toString: String = s"${udfName.getOrElse("UDF")}(${children.mkString(", ")})" - override lazy val canonicalized: Expression = { - // SPARK-32307: `ExpressionEncoder` can't be canonicalized, and technically we don't - // need it to identify a `ScalaUDF`. - Canonicalize.execute(copy(children = children.map(_.canonicalized), inputEncoders = Nil)) - } - /** * The analyzer should be aware of Scala primitive types so as to make the * UDF return null if there is any null input value of these types. On the diff --git a/sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala index 2ab14d5..91e9f1d 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala @@ -609,16 +609,4 @@ class UDFSuite extends QueryTest with SharedSparkSession { } assert(e2.getMessage.contains("UDFSuite$MalformedClassObject$MalformedPrimitiveFunction")) } - - test("SPARK-32307: Aggression that use map type input UDF as group expression") { - spark.udf.register("key", udf((m: Map[String, String]) => m.keys.head.toInt)) - Seq(Map("1" -> "one", "2" -> "two")).toDF("a").createOrReplaceTempView("t") - checkAnswer(sql("SELECT key(a) AS k FROM t GROUP BY key(a)"), Row(1) :: Nil) - } - - test("SPARK-32307: Aggression that use array type input UDF as group expression") { - spark.udf.register("key", udf((m: Array[Int]) => m.head)) - Seq(Array(1)).toDF("a").createOrReplaceTempView("t") - checkAnswer(sql("SELECT key(a) AS k FROM t GROUP BY key(a)"), Row(1) :: Nil) - } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org