class_docstr: Wrapper for user-defined function registration. This instance can be accessed by
  :attr:`spark.udf` or :attr:`sqlContext.udf`.
  
  .. versionadded:: 1.3.1
class_docstr_tok: ["Wrapper","for","user-defined","function","registration",".","This","instance","can","be","accessed","by",":","attr",":","`","spark.udf","`","or",":","attr",":","`","sqlContext.udf","`",".","..","versionadded",":",":","1.3.1"]
docstr: Register a Java user-defined function as a SQL function.
  
  In addition to a name and the function itself, the return type can be optionally specified.
  When the return type is not specified we would infer it via reflection.
  
  .. versionadded:: 2.3.0
  
  .. versionchanged:: 3.4.0
      Supports Spark Connect.
  
  Parameters
  ----------
  name : str
      name of the user-defined function
  javaClassName : str
      fully qualified name of java class
  returnType : :class:`pyspark.sql.types.DataType` or str, optional
      the return type of the registered Java function. The value can be either
      a :class:`pyspark.sql.types.DataType` object or a DDL-formatted type string.
  
  Examples
  --------
  >>> from pyspark.sql.types import IntegerType
  >>> spark.udf.registerJavaFunction(
  ...     "javaStringLength", "test.org.apache.spark.sql.JavaStringLength", IntegerType())
  ... # doctest: +SKIP
  >>> spark.sql("SELECT javaStringLength('test')").collect()  # doctest: +SKIP
  [Row(javaStringLength(test)=4)]
  
  >>> spark.udf.registerJavaFunction(
  ...     "javaStringLength2", "test.org.apache.spark.sql.JavaStringLength")
  ... # doctest: +SKIP
  >>> spark.sql("SELECT javaStringLength2('test')").collect()  # doctest: +SKIP
  [Row(javaStringLength2(test)=4)]
  
  >>> spark.udf.registerJavaFunction(
  ...     "javaStringLength3", "test.org.apache.spark.sql.JavaStringLength", "integer")
  ... # doctest: +SKIP
  >>> spark.sql("SELECT javaStringLength3('test')").collect()  # doctest: +SKIP
  [Row(javaStringLength3(test)=4)]
docstr_tok: ["Register","a","Java","user-defined","function","as","a","SQL","function",".","In","addition","to","a","name","and","the","function","itself",",","the","return","type","can","be","optionally","specified",".","When","the","return","type","is","not","specified","we","would","infer","it","via","reflection",".","..","versionadded",":",":","2.3.0","..","versionchanged",":",":","3.4.0","Supports","Spark","Connect",".","Parameters","--","--","--","--","--","name",":","str","name","of","the","user-defined","function","javaClassName",":","str","fully","qualified","name","of","java","class","returnType",":",":","class",":","`","pyspark.sql.types.DataType","`","or","str",",","optional","the","return","type","of","the","registered","Java","function",".","The","value","can","be","either","a",":","class",":","`","pyspark.sql.types.DataType","`","object","or","a","DDL-formatted","type","string",".","Examples","--","--","--","--",">",">",">","from","pyspark.sql.types","import","IntegerType",">",">",">","spark.udf.registerJavaFunction","(","...","``","javaStringLength","''",",","``","test.org.apache.spark.sql.JavaStringLength","''",",","IntegerType","(",")",")","...","#","doctest",":","+SKIP",">",">",">","spark.sql","(","``","SELECT","javaStringLength","(","'test","'",")","''",")",".collect","(",")","#","doctest",":","+SKIP","[","Row","(","javaStringLength","(","test",")","=4",")","]",">",">",">","spark.udf.registerJavaFunction","(","...","``","javaStringLength2","''",",","``","test.org.apache.spark.sql.JavaStringLength","''",")","...","#","doctest",":","+SKIP",">",">",">","spark.sql","(","``","SELECT","javaStringLength2","(","'test","'",")","''",")",".collect","(",")","#","doctest",":","+SKIP","[","Row","(","javaStringLength2","(","test",")","=4",")","]",">",">",">","spark.udf.registerJavaFunction","(","...","``","javaStringLength3","''",",","``","test.org.apache.spark.sql.JavaStringLength","''",",","``","integer","''",")","...","#","doctest",":","+SKIP",">",">",">","spark.sql","(","``","SELECT","javaStringLength3","(","'test","'",")","''",")",".collect","(",")","#","doctest",":","+SKIP","[","Row","(","javaStringLength3","(","test",")","=4",")","]"]
code: def registerJavaFunction(
      self,
      name: str,
      javaClassName: str,
      returnType: Optional["DataTypeOrString"] = None,
  ) -> None:
      """Register a Java user-defined function as a SQL function.
  
      In addition to a name and the function itself, the return type can be optionally specified.
      When the return type is not specified we would infer it via reflection.
  
      .. versionadded:: 2.3.0
  
      .. versionchanged:: 3.4.0
          Supports Spark Connect.
  
      Parameters
      ----------
      name : str
          name of the user-defined function
      javaClassName : str
          fully qualified name of java class
      returnType : :class:`pyspark.sql.types.DataType` or str, optional
          the return type of the registered Java function. The value can be either
          a :class:`pyspark.sql.types.DataType` object or a DDL-formatted type string.
  
      Examples
      --------
      >>> from pyspark.sql.types import IntegerType
      >>> spark.udf.registerJavaFunction(
      ...     "javaStringLength", "test.org.apache.spark.sql.JavaStringLength", IntegerType())
      ... # doctest: +SKIP
      >>> spark.sql("SELECT javaStringLength('test')").collect()  # doctest: +SKIP
      [Row(javaStringLength(test)=4)]
  
      >>> spark.udf.registerJavaFunction(
      ...     "javaStringLength2", "test.org.apache.spark.sql.JavaStringLength")
      ... # doctest: +SKIP
      >>> spark.sql("SELECT javaStringLength2('test')").collect()  # doctest: +SKIP
      [Row(javaStringLength2(test)=4)]
  
      >>> spark.udf.registerJavaFunction(
      ...     "javaStringLength3", "test.org.apache.spark.sql.JavaStringLength", "integer")
      ... # doctest: +SKIP
      >>> spark.sql("SELECT javaStringLength3('test')").collect()  # doctest: +SKIP
      [Row(javaStringLength3(test)=4)]
      """
  
      jdt = None
      if returnType is not None:
          if not isinstance(returnType, DataType):
              returnType = _parse_datatype_string(returnType)
          jdt = self.sparkSession._jsparkSession.parseDataType(
              returnType.json()
          )
      self.sparkSession._jsparkSession.udf().registerJava(
          name, javaClassName, jdt
      )
  
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 3 for calling the UDFRegistration obj's underlying member method code with example usage: obj.registerJavaFunction(name, javaClassName, returnType) without return types