Skip to content

FunctionRegistry

FunctionRegistry is an extension of the FunctionRegistryBase abstraction for function registries with functions that produce a result of Expression type.

Implementations

Accessing FunctionRegistry

FunctionRegistry is available using SessionState.functionRegistry.

import org.apache.spark.sql.catalyst.analysis.FunctionRegistry
assert(spark.sessionState.functionRegistry.isInstanceOf[FunctionRegistry])

Built-In Functions

builtin: SimpleFunctionRegistry

builtin creates a new SimpleFunctionRegistry and registers all the built-in function expressions.


builtin is used when:

logicalPlan

type TableFunctionBuilder = Seq[Expression] => LogicalPlan
logicalPlan[T <: LogicalPlan : ClassTag](
  name: String): (String, (ExpressionInfo, TableFunctionBuilder))

logicalPlan builds info and builder for the given name table function and returns a tuple of the following:

  • The given name
  • The info
  • A function that uses the builder to build a LogicalPlan for a given Expressions

logicalPlan is used when:

generator

type TableFunctionBuilder = Seq[Expression] => LogicalPlan
generator[T <: Generator : ClassTag](
  name: String,
  outer: Boolean = false): (String, (ExpressionInfo, TableFunctionBuilder))

generator...FIXME


generator is used when:

Expression

expression[T <: Expression : ClassTag](
  name: String,
  setAlias: Boolean = false,
  since: Option[String] = None): (String, (ExpressionInfo, FunctionBuilder))

expression builds a function builder for the given name and since.

expression creates a new builder that accepts Expressions and (among other things) asserts that no NamedArgumentExpression is among the given Expressions. If there are any, expression reports an AnalysisException:

Named parameters are not supported for function [functionName];
please retry the query with positional arguments to the function call instead.

expression is used when: