Skip to content

UDFRegistration

UDFRegistration is a facade to a session-scoped FunctionRegistry to register user-defined functions (UDFs) and user-defined aggregate functions (UDAFs).

Creating Instance

UDFRegistration takes the following to be created:

UDFRegistration is created when:

Accessing UDFRegistration

UDFRegistration is available using SparkSession.udf.

import org.apache.spark.sql.SparkSession
assert(spark.isInstanceOf[SparkSession])
import org.apache.spark.sql.UDFRegistration
assert(spark.udf.isInstanceOf[UDFRegistration])

SessionState

UDFRegistration is used to create a SessionState.

Registering UserDefinedFunction

register(
  name: String,
  udf: UserDefinedFunction): UserDefinedFunction

register associates the given name with the given UserDefinedFunction.

register requests the FunctionRegistry to createOrReplaceTempFunction under the given name and with scala_udf source name and a function builder based on the type of the UserDefinedFunction:

Back to top