You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by zs...@apache.org on 2018/02/13 19:56:52 UTC
spark git commit: [SPARK-23400][SQL] Add a constructors for ScalaUDF
Repository: spark
Updated Branches:
refs/heads/master d58fe2883 -> 2ee76c22b
[SPARK-23400][SQL] Add a constructors for ScalaUDF
## What changes were proposed in this pull request?
In this upcoming 2.3 release, we changed the interface of `ScalaUDF`. Unfortunately, some Spark packages (e.g., spark-deep-learning) are using our internal class `ScalaUDF`. In the release 2.3, we added new parameters into this class. The users hit the binary compatibility issues and got the exception:
```
> java.lang.NoSuchMethodError: org.apache.spark.sql.catalyst.expressions.ScalaUDF.<init>(Ljava/lang/Object;Lorg/apache/spark/sql/types/DataType;Lscala/collection/Seq;Lscala/collection/Seq;Lscala/Option;)V
```
This PR is to improve the backward compatibility. However, we definitely should not encourage the external packages to use our internal classes. This might make us hard to maintain/develop the codes in Spark.
## How was this patch tested?
N/A
Author: gatorsmile <ga...@gmail.com>
Closes #20591 from gatorsmile/scalaUDF.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/2ee76c22
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/2ee76c22
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/2ee76c22
Branch: refs/heads/master
Commit: 2ee76c22b6e48e643694c9475e5f0d37124215e7
Parents: d58fe28
Author: gatorsmile <ga...@gmail.com>
Authored: Tue Feb 13 11:56:49 2018 -0800
Committer: Shixiong Zhu <zs...@gmail.com>
Committed: Tue Feb 13 11:56:49 2018 -0800
----------------------------------------------------------------------
.../apache/spark/sql/catalyst/expressions/ScalaUDF.scala | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/2ee76c22/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ScalaUDF.scala
----------------------------------------------------------------------
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 388ef42..989c023 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
@@ -49,6 +49,17 @@ case class ScalaUDF(
udfDeterministic: Boolean = true)
extends Expression with ImplicitCastInputTypes with NonSQLExpression with UserDefinedExpression {
+ // The constructor for SPARK 2.1 and 2.2
+ def this(
+ function: AnyRef,
+ dataType: DataType,
+ children: Seq[Expression],
+ inputTypes: Seq[DataType],
+ udfName: Option[String]) = {
+ this(
+ function, dataType, children, inputTypes, udfName, nullable = true, udfDeterministic = true)
+ }
+
override lazy val deterministic: Boolean = udfDeterministic && children.forall(_.deterministic)
override def toString: String =
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org