[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 <gatorsmile@gmail.com> Closes #20591 from gatorsmile/scalaUDF.
This commit is contained in:
parent
d58fe28836
commit
2ee76c22b6
|
@ -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 =
|
||||
|
|
Loading…
Reference in a new issue