@@ -3874,7 +3874,7 @@ object functions {
38743874 |def udf[$typeTags](f: Function$x[$types]): UserDefinedFunction = {
38753875 | val ScalaReflection.Schema(dataType, nullable) = ScalaReflection.schemaFor[RT]
38763876 | val inputSchemas = $inputSchemas
3877- | val udf = SparkUserDefinedFunction.create (f, dataType, inputSchemas)
3877+ | val udf = SparkUserDefinedFunction(f, dataType, inputSchemas)
38783878 | if (nullable) udf else udf.asNonNullable()
38793879 |}""".stripMargin)
38803880 }
@@ -3897,7 +3897,7 @@ object functions {
38973897 | */
38983898 |def udf(f: UDF$i[$extTypeArgs], returnType: DataType): UserDefinedFunction = {
38993899 | val func = f$anyCast.call($anyParams)
3900- | SparkUserDefinedFunction.create ($funcCall, returnType, inputSchemas = Seq.fill($i)(None))
3900+ | SparkUserDefinedFunction($funcCall, returnType, inputSchemas = Seq.fill($i)(None))
39013901 |}""".stripMargin)
39023902 }
39033903
@@ -3919,7 +3919,7 @@ object functions {
39193919 def udf [RT : TypeTag ](f : Function0 [RT ]): UserDefinedFunction = {
39203920 val ScalaReflection .Schema (dataType, nullable) = ScalaReflection .schemaFor[RT ]
39213921 val inputSchemas = Nil
3922- val udf = SparkUserDefinedFunction .create (f, dataType, inputSchemas)
3922+ val udf = SparkUserDefinedFunction (f, dataType, inputSchemas)
39233923 if (nullable) udf else udf.asNonNullable()
39243924 }
39253925
@@ -3935,7 +3935,7 @@ object functions {
39353935 def udf [RT : TypeTag , A1 : TypeTag ](f : Function1 [A1 , RT ]): UserDefinedFunction = {
39363936 val ScalaReflection .Schema (dataType, nullable) = ScalaReflection .schemaFor[RT ]
39373937 val inputSchemas = Try (ScalaReflection .schemaFor(typeTag[A1 ])).toOption :: Nil
3938- val udf = SparkUserDefinedFunction .create (f, dataType, inputSchemas)
3938+ val udf = SparkUserDefinedFunction (f, dataType, inputSchemas)
39393939 if (nullable) udf else udf.asNonNullable()
39403940 }
39413941
@@ -3951,7 +3951,7 @@ object functions {
39513951 def udf [RT : TypeTag , A1 : TypeTag , A2 : TypeTag ](f : Function2 [A1 , A2 , RT ]): UserDefinedFunction = {
39523952 val ScalaReflection .Schema (dataType, nullable) = ScalaReflection .schemaFor[RT ]
39533953 val inputSchemas = Try (ScalaReflection .schemaFor(typeTag[A1 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A2 ])).toOption :: Nil
3954- val udf = SparkUserDefinedFunction .create (f, dataType, inputSchemas)
3954+ val udf = SparkUserDefinedFunction (f, dataType, inputSchemas)
39553955 if (nullable) udf else udf.asNonNullable()
39563956 }
39573957
@@ -3967,7 +3967,7 @@ object functions {
39673967 def udf [RT : TypeTag , A1 : TypeTag , A2 : TypeTag , A3 : TypeTag ](f : Function3 [A1 , A2 , A3 , RT ]): UserDefinedFunction = {
39683968 val ScalaReflection .Schema (dataType, nullable) = ScalaReflection .schemaFor[RT ]
39693969 val inputSchemas = Try (ScalaReflection .schemaFor(typeTag[A1 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A2 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A3 ])).toOption :: Nil
3970- val udf = SparkUserDefinedFunction .create (f, dataType, inputSchemas)
3970+ val udf = SparkUserDefinedFunction (f, dataType, inputSchemas)
39713971 if (nullable) udf else udf.asNonNullable()
39723972 }
39733973
@@ -3983,7 +3983,7 @@ object functions {
39833983 def udf [RT : TypeTag , A1 : TypeTag , A2 : TypeTag , A3 : TypeTag , A4 : TypeTag ](f : Function4 [A1 , A2 , A3 , A4 , RT ]): UserDefinedFunction = {
39843984 val ScalaReflection .Schema (dataType, nullable) = ScalaReflection .schemaFor[RT ]
39853985 val inputSchemas = Try (ScalaReflection .schemaFor(typeTag[A1 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A2 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A3 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A4 ])).toOption :: Nil
3986- val udf = SparkUserDefinedFunction .create (f, dataType, inputSchemas)
3986+ val udf = SparkUserDefinedFunction (f, dataType, inputSchemas)
39873987 if (nullable) udf else udf.asNonNullable()
39883988 }
39893989
@@ -3999,7 +3999,7 @@ object functions {
39993999 def udf [RT : TypeTag , A1 : TypeTag , A2 : TypeTag , A3 : TypeTag , A4 : TypeTag , A5 : TypeTag ](f : Function5 [A1 , A2 , A3 , A4 , A5 , RT ]): UserDefinedFunction = {
40004000 val ScalaReflection .Schema (dataType, nullable) = ScalaReflection .schemaFor[RT ]
40014001 val inputSchemas = Try (ScalaReflection .schemaFor(typeTag[A1 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A2 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A3 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A4 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A5 ])).toOption :: Nil
4002- val udf = SparkUserDefinedFunction .create (f, dataType, inputSchemas)
4002+ val udf = SparkUserDefinedFunction (f, dataType, inputSchemas)
40034003 if (nullable) udf else udf.asNonNullable()
40044004 }
40054005
@@ -4015,7 +4015,7 @@ object functions {
40154015 def udf [RT : TypeTag , A1 : TypeTag , A2 : TypeTag , A3 : TypeTag , A4 : TypeTag , A5 : TypeTag , A6 : TypeTag ](f : Function6 [A1 , A2 , A3 , A4 , A5 , A6 , RT ]): UserDefinedFunction = {
40164016 val ScalaReflection .Schema (dataType, nullable) = ScalaReflection .schemaFor[RT ]
40174017 val inputSchemas = Try (ScalaReflection .schemaFor(typeTag[A1 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A2 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A3 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A4 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A5 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A6 ])).toOption :: Nil
4018- val udf = SparkUserDefinedFunction .create (f, dataType, inputSchemas)
4018+ val udf = SparkUserDefinedFunction (f, dataType, inputSchemas)
40194019 if (nullable) udf else udf.asNonNullable()
40204020 }
40214021
@@ -4031,7 +4031,7 @@ object functions {
40314031 def udf [RT : TypeTag , A1 : TypeTag , A2 : TypeTag , A3 : TypeTag , A4 : TypeTag , A5 : TypeTag , A6 : TypeTag , A7 : TypeTag ](f : Function7 [A1 , A2 , A3 , A4 , A5 , A6 , A7 , RT ]): UserDefinedFunction = {
40324032 val ScalaReflection .Schema (dataType, nullable) = ScalaReflection .schemaFor[RT ]
40334033 val inputSchemas = Try (ScalaReflection .schemaFor(typeTag[A1 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A2 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A3 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A4 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A5 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A6 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A7 ])).toOption :: Nil
4034- val udf = SparkUserDefinedFunction .create (f, dataType, inputSchemas)
4034+ val udf = SparkUserDefinedFunction (f, dataType, inputSchemas)
40354035 if (nullable) udf else udf.asNonNullable()
40364036 }
40374037
@@ -4047,7 +4047,7 @@ object functions {
40474047 def udf [RT : TypeTag , A1 : TypeTag , A2 : TypeTag , A3 : TypeTag , A4 : TypeTag , A5 : TypeTag , A6 : TypeTag , A7 : TypeTag , A8 : TypeTag ](f : Function8 [A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , RT ]): UserDefinedFunction = {
40484048 val ScalaReflection .Schema (dataType, nullable) = ScalaReflection .schemaFor[RT ]
40494049 val inputSchemas = Try (ScalaReflection .schemaFor(typeTag[A1 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A2 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A3 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A4 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A5 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A6 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A7 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A8 ])).toOption :: Nil
4050- val udf = SparkUserDefinedFunction .create (f, dataType, inputSchemas)
4050+ val udf = SparkUserDefinedFunction (f, dataType, inputSchemas)
40514051 if (nullable) udf else udf.asNonNullable()
40524052 }
40534053
@@ -4063,7 +4063,7 @@ object functions {
40634063 def udf [RT : TypeTag , A1 : TypeTag , A2 : TypeTag , A3 : TypeTag , A4 : TypeTag , A5 : TypeTag , A6 : TypeTag , A7 : TypeTag , A8 : TypeTag , A9 : TypeTag ](f : Function9 [A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , RT ]): UserDefinedFunction = {
40644064 val ScalaReflection .Schema (dataType, nullable) = ScalaReflection .schemaFor[RT ]
40654065 val inputSchemas = Try (ScalaReflection .schemaFor(typeTag[A1 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A2 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A3 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A4 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A5 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A6 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A7 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A8 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A9 ])).toOption :: Nil
4066- val udf = SparkUserDefinedFunction .create (f, dataType, inputSchemas)
4066+ val udf = SparkUserDefinedFunction (f, dataType, inputSchemas)
40674067 if (nullable) udf else udf.asNonNullable()
40684068 }
40694069
@@ -4079,7 +4079,7 @@ object functions {
40794079 def udf [RT : TypeTag , A1 : TypeTag , A2 : TypeTag , A3 : TypeTag , A4 : TypeTag , A5 : TypeTag , A6 : TypeTag , A7 : TypeTag , A8 : TypeTag , A9 : TypeTag , A10 : TypeTag ](f : Function10 [A1 , A2 , A3 , A4 , A5 , A6 , A7 , A8 , A9 , A10 , RT ]): UserDefinedFunction = {
40804080 val ScalaReflection .Schema (dataType, nullable) = ScalaReflection .schemaFor[RT ]
40814081 val inputSchemas = Try (ScalaReflection .schemaFor(typeTag[A1 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A2 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A3 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A4 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A5 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A6 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A7 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A8 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A9 ])).toOption :: Try (ScalaReflection .schemaFor(typeTag[A10 ])).toOption :: Nil
4082- val udf = SparkUserDefinedFunction .create (f, dataType, inputSchemas)
4082+ val udf = SparkUserDefinedFunction (f, dataType, inputSchemas)
40834083 if (nullable) udf else udf.asNonNullable()
40844084 }
40854085
@@ -4098,7 +4098,7 @@ object functions {
40984098 */
40994099 def udf (f : UDF0 [_], returnType : DataType ): UserDefinedFunction = {
41004100 val func = f.asInstanceOf [UDF0 [Any ]].call()
4101- SparkUserDefinedFunction .create (() => func, returnType, inputSchemas = Seq .fill(0 )(None ))
4101+ SparkUserDefinedFunction (() => func, returnType, inputSchemas = Seq .fill(0 )(None ))
41024102 }
41034103
41044104 /**
@@ -4112,7 +4112,7 @@ object functions {
41124112 */
41134113 def udf (f : UDF1 [_, _], returnType : DataType ): UserDefinedFunction = {
41144114 val func = f.asInstanceOf [UDF1 [Any , Any ]].call(_ : Any )
4115- SparkUserDefinedFunction .create (func, returnType, inputSchemas = Seq .fill(1 )(None ))
4115+ SparkUserDefinedFunction (func, returnType, inputSchemas = Seq .fill(1 )(None ))
41164116 }
41174117
41184118 /**
@@ -4126,7 +4126,7 @@ object functions {
41264126 */
41274127 def udf (f : UDF2 [_, _, _], returnType : DataType ): UserDefinedFunction = {
41284128 val func = f.asInstanceOf [UDF2 [Any , Any , Any ]].call(_ : Any , _ : Any )
4129- SparkUserDefinedFunction .create (func, returnType, inputSchemas = Seq .fill(2 )(None ))
4129+ SparkUserDefinedFunction (func, returnType, inputSchemas = Seq .fill(2 )(None ))
41304130 }
41314131
41324132 /**
@@ -4140,7 +4140,7 @@ object functions {
41404140 */
41414141 def udf (f : UDF3 [_, _, _, _], returnType : DataType ): UserDefinedFunction = {
41424142 val func = f.asInstanceOf [UDF3 [Any , Any , Any , Any ]].call(_ : Any , _ : Any , _ : Any )
4143- SparkUserDefinedFunction .create (func, returnType, inputSchemas = Seq .fill(3 )(None ))
4143+ SparkUserDefinedFunction (func, returnType, inputSchemas = Seq .fill(3 )(None ))
41444144 }
41454145
41464146 /**
@@ -4154,7 +4154,7 @@ object functions {
41544154 */
41554155 def udf (f : UDF4 [_, _, _, _, _], returnType : DataType ): UserDefinedFunction = {
41564156 val func = f.asInstanceOf [UDF4 [Any , Any , Any , Any , Any ]].call(_ : Any , _ : Any , _ : Any , _ : Any )
4157- SparkUserDefinedFunction .create (func, returnType, inputSchemas = Seq .fill(4 )(None ))
4157+ SparkUserDefinedFunction (func, returnType, inputSchemas = Seq .fill(4 )(None ))
41584158 }
41594159
41604160 /**
@@ -4168,7 +4168,7 @@ object functions {
41684168 */
41694169 def udf (f : UDF5 [_, _, _, _, _, _], returnType : DataType ): UserDefinedFunction = {
41704170 val func = f.asInstanceOf [UDF5 [Any , Any , Any , Any , Any , Any ]].call(_ : Any , _ : Any , _ : Any , _ : Any , _ : Any )
4171- SparkUserDefinedFunction .create (func, returnType, inputSchemas = Seq .fill(5 )(None ))
4171+ SparkUserDefinedFunction (func, returnType, inputSchemas = Seq .fill(5 )(None ))
41724172 }
41734173
41744174 /**
@@ -4182,7 +4182,7 @@ object functions {
41824182 */
41834183 def udf (f : UDF6 [_, _, _, _, _, _, _], returnType : DataType ): UserDefinedFunction = {
41844184 val func = f.asInstanceOf [UDF6 [Any , Any , Any , Any , Any , Any , Any ]].call(_ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any )
4185- SparkUserDefinedFunction .create (func, returnType, inputSchemas = Seq .fill(6 )(None ))
4185+ SparkUserDefinedFunction (func, returnType, inputSchemas = Seq .fill(6 )(None ))
41864186 }
41874187
41884188 /**
@@ -4196,7 +4196,7 @@ object functions {
41964196 */
41974197 def udf (f : UDF7 [_, _, _, _, _, _, _, _], returnType : DataType ): UserDefinedFunction = {
41984198 val func = f.asInstanceOf [UDF7 [Any , Any , Any , Any , Any , Any , Any , Any ]].call(_ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any )
4199- SparkUserDefinedFunction .create (func, returnType, inputSchemas = Seq .fill(7 )(None ))
4199+ SparkUserDefinedFunction (func, returnType, inputSchemas = Seq .fill(7 )(None ))
42004200 }
42014201
42024202 /**
@@ -4210,7 +4210,7 @@ object functions {
42104210 */
42114211 def udf (f : UDF8 [_, _, _, _, _, _, _, _, _], returnType : DataType ): UserDefinedFunction = {
42124212 val func = f.asInstanceOf [UDF8 [Any , Any , Any , Any , Any , Any , Any , Any , Any ]].call(_ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any )
4213- SparkUserDefinedFunction .create (func, returnType, inputSchemas = Seq .fill(8 )(None ))
4213+ SparkUserDefinedFunction (func, returnType, inputSchemas = Seq .fill(8 )(None ))
42144214 }
42154215
42164216 /**
@@ -4224,7 +4224,7 @@ object functions {
42244224 */
42254225 def udf (f : UDF9 [_, _, _, _, _, _, _, _, _, _], returnType : DataType ): UserDefinedFunction = {
42264226 val func = f.asInstanceOf [UDF9 [Any , Any , Any , Any , Any , Any , Any , Any , Any , Any ]].call(_ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any )
4227- SparkUserDefinedFunction .create (func, returnType, inputSchemas = Seq .fill(9 )(None ))
4227+ SparkUserDefinedFunction (func, returnType, inputSchemas = Seq .fill(9 )(None ))
42284228 }
42294229
42304230 /**
@@ -4238,7 +4238,7 @@ object functions {
42384238 */
42394239 def udf (f : UDF10 [_, _, _, _, _, _, _, _, _, _, _], returnType : DataType ): UserDefinedFunction = {
42404240 val func = f.asInstanceOf [UDF10 [Any , Any , Any , Any , Any , Any , Any , Any , Any , Any , Any ]].call(_ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any , _ : Any )
4241- SparkUserDefinedFunction .create (func, returnType, inputSchemas = Seq .fill(10 )(None ))
4241+ SparkUserDefinedFunction (func, returnType, inputSchemas = Seq .fill(10 )(None ))
42424242 }
42434243
42444244 // scalastyle:on parameter.number
@@ -4257,9 +4257,7 @@ object functions {
42574257 * @since 2.0.0
42584258 */
42594259 def udf (f : AnyRef , dataType : DataType ): UserDefinedFunction = {
4260- // TODO: should call SparkUserDefinedFunction.create() instead but inputSchemas is currently
4261- // unavailable. We may need to create type-safe overloaded versions of udf() methods.
4262- SparkUserDefinedFunction (f, dataType, inputTypes = None , nullableTypes = None )
4260+ SparkUserDefinedFunction (f, dataType, inputSchemas = Nil )
42634261 }
42644262
42654263 /**
0 commit comments