FunctionRegistry — Contract for Function Registries (Catalogs)
FunctionRegistry
is the contract of function registries (catalogs) of native and user-defined functions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
package org.apache.spark.sql.catalyst.analysis trait FunctionRegistry { // only required properties (vals and methods) that have no implementation // the others follow def clear(): Unit def dropFunction(name: FunctionIdentifier): Boolean def listFunction(): Seq[FunctionIdentifier] def lookupFunction(name: FunctionIdentifier): Option[ExpressionInfo] def lookupFunction(name: FunctionIdentifier, children: Seq[Expression]): Expression def lookupFunctionBuilder(name: FunctionIdentifier): Option[FunctionBuilder] def registerFunction( name: FunctionIdentifier, info: ExpressionInfo, builder: FunctionBuilder): Unit } |
Property | Description |
---|---|
|
Used exclusively when |
|
|
|
|
|
Used when:
|
|
|
|
Used when:
|
Note
|
The one and only FunctionRegistry available in Spark SQL is SimpleFunctionRegistry.
|
FunctionRegistry
is available through functionRegistry property of a SessionState
(that is available as sessionState property of a SparkSession
).
1 2 3 4 5 6 7 8 9 |
scala> :type spark org.apache.spark.sql.SparkSession scala> :type spark.sessionState.functionRegistry org.apache.spark.sql.catalyst.analysis.FunctionRegistry |
Note
|
You can register a new user-defined function using UDFRegistration. |
Name | Description |
---|---|
SimpleFunctionRegistry with the built-in functions registered. |
FunctionRegistry
manages function expression registry of Catalyst expressions and the corresponding built-in/native SQL functions (that can be used in SQL statements).
Catalyst Expression | SQL Function |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expression
Internal Method
1 2 3 4 5 6 |
expression[T <: Expression](name: String) (implicit tag: ClassTag[T]): (String, (ExpressionInfo, FunctionBuilder)) |
expression
…FIXME
Note
|
expression is used when…FIXME
|
SimpleFunctionRegistry
SimpleFunctionRegistry
is the default FunctionRegistry that is backed by a hash map (with optional case sensitivity).
createOrReplaceTempFunction
Final Method
1 2 3 4 5 |
createOrReplaceTempFunction(name: String, builder: FunctionBuilder): Unit |
createOrReplaceTempFunction
…FIXME
Note
|
createOrReplaceTempFunction is used exclusively when UDFRegistration is requested to register an user-defined function, user-defined aggregate function, user-defined function (as UserDefinedFunction) or registerPython .
|