File tree Expand file tree Collapse file tree 4 files changed +11
-1
lines changed
core/src/main/scala/org/apache/spark/api/python
sql/core/src/main/scala/org/apache/spark/sql Expand file tree Collapse file tree 4 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,13 @@ private[spark] object PythonEvalType {
3939
4040 val SQL_PANDAS_SCALAR_UDF = 200
4141 val SQL_PANDAS_GROUP_MAP_UDF = 201
42+
43+ def toString (pythonEvalType : Int ): String = pythonEvalType match {
44+ case NON_UDF => " NON_UDF"
45+ case SQL_BATCHED_UDF => " SQL_BATCHED_UDF"
46+ case SQL_PANDAS_SCALAR_UDF => " SQL_PANDAS_SCALAR_UDF"
47+ case SQL_PANDAS_GROUP_MAP_UDF => " SQL_PANDAS_GROUP_MAP_UDF"
48+ }
4249}
4350
4451/**
Original file line number Diff line number Diff line change @@ -439,7 +439,6 @@ def test_nondeterministic_udf(self):
439439 import random
440440 udf_random_col = udf (lambda : int (100 * random .random ()), IntegerType ()).asNondeterministic ()
441441 df = self .spark .createDataFrame ([Row (1 )]).select (udf_random_col ().alias ('RAND' ))
442- random .seed (1234 )
443442 udf_add_ten = udf (lambda rand : rand + 10 , IntegerType ())
444443 [row ] = df .withColumn ('RAND_PLUS_TEN' , udf_add_ten ('RAND' )).collect ()
445444 self .assertEqual (row [0 ] + 10 , row [1 ])
Original file line number Diff line number Diff line change @@ -165,6 +165,8 @@ def wrapper(*args):
165165 def asNondeterministic (self ):
166166 """
167167 Updates UserDefinedFunction to nondeterministic.
168+
169+ .. versionadded:: 2.3
168170 """
169171 self ._deterministic = False
170172 return self
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import scala.reflect.runtime.universe.TypeTag
2323import scala .util .Try
2424
2525import org .apache .spark .annotation .InterfaceStability
26+ import org .apache .spark .api .python .PythonEvalType
2627import org .apache .spark .internal .Logging
2728import org .apache .spark .sql .api .java ._
2829import org .apache .spark .sql .catalyst .{JavaTypeInference , ScalaReflection }
@@ -58,6 +59,7 @@ class UDFRegistration private[sql] (functionRegistry: FunctionRegistry) extends
5859 | pythonIncludes: ${udf.func.pythonIncludes}
5960 | pythonExec: ${udf.func.pythonExec}
6061 | dataType: ${udf.dataType}
62+ | pythonEvalType: ${PythonEvalType .toString(udf.pythonEvalType)}
6163 | udfDeterministic: ${udf.udfDeterministic}
6264 """ .stripMargin)
6365
You can’t perform that action at this time.
0 commit comments