class_docstr: User defined function in Python
  
  .. versionadded:: 1.3
  
  Notes
  -----
  The constructor of this class is not supposed to be directly called.
  Use :meth:`pyspark.sql.functions.udf` or :meth:`pyspark.sql.functions.pandas_udf`
  to create this instance.
class_docstr_tok: ["User","defined","function","in","Python","..","versionadded",":",":","1.3","Notes","--","--","-","The","constructor","of","this","class","is","not","supposed","to","be","directly","called",".","Use",":","meth",":","`","pyspark.sql.functions.udf","`","or",":","meth",":","`","pyspark.sql.functions.pandas_udf","`","to","create","this","instance","."]
code: def __init__(
      self,
      func: Callable[..., Any],
      returnType: "DataTypeOrString" = StringType(),
      name: Optional[str] = None,
      evalType: int = PythonEvalType.SQL_BATCHED_UDF,
      deterministic: bool = True,
  ):
      if not callable(func):
          raise PySparkTypeError(
              error_class="NOT_CALLABLE",
              message_parameters={
                  "arg_name": "func",
                  "arg_type": type(func).__name__,
              },
          )
  
      if not isinstance(returnType, (DataType, str)):
          raise PySparkTypeError(
              error_class="NOT_DATATYPE_OR_STR",
              message_parameters={
                  "arg_name": "returnType",
                  "arg_type": type(returnType).__name__,
              },
          )
  
      if not isinstance(evalType, int):
          raise PySparkTypeError(
              error_class="NOT_INT",
              message_parameters={
                  "arg_name": "evalType",
                  "arg_type": type(evalType).__name__,
              },
          )
  
      self.func = func
      self._returnType = returnType
      # Stores UserDefinedPythonFunctions jobj, once initialized
      self._returnType_placeholder: Optional[DataType] = None
      self._judf_placeholder = None
      self._name = name or (
          func.__name__
          if hasattr(func, "__name__")
          else func.__class__.__name__
      )
      self.evalType = evalType
      self.deterministic = deterministic
  
imports: from inspect import getfullargspec
  import functools
  import inspect
  import sys
  import warnings
  from typing import Callable, Any, TYPE_CHECKING, Optional, cast, Union
  from py4j.java_gateway import JavaObject
  from pyspark import SparkContext
  from pyspark.rdd import _prepare_for_python_RDD, PythonEvalType
  from pyspark.sql.column import Column, _to_java_expr, _to_seq
  from pyspark.sql.types import DataType, StringType, StructType, _parse_datatype_string
  from pyspark.sql.utils import get_active_spark_context
  from pyspark.sql.pandas.types import to_arrow_type
  from pyspark.sql.pandas.utils import require_minimum_pandas_version, require_minimum_pyarrow_version
  from pyspark.errors import PySparkTypeError, PySparkNotImplementedError, PySparkRuntimeError
label_desc: Use image node_id 1 to create a new UserDefinedFunction object  with example: obj = UserDefinedFunction(func, returnType, name, evalType, deterministic)