gravitino.api.function.function_definition.FunctionDefinition

class gravitino.api.function.function_definition.FunctionDefinition

Bases: ABC

A function definition that pairs a specific parameter list with its implementations.

A single function can include multiple definitions (overloads), each with distinct parameters, return types, and implementations.

For scalar or aggregate functions, use return_type() to specify the return type. For table-valued functions, use return_columns() to specify the output columns.

__init__()

Methods

__init__()

impls()

Returns the implementations associated with this definition.

parameters()

Returns the parameters for this definition.

return_columns()

The output columns for a table-valued function definition.

return_type()

The return type for scalar or aggregate function definitions.

Attributes

EMPTY_COLUMNS

An empty list of FunctionColumn.

EMPTY_COLUMNS: List[FunctionColumn] = []

An empty list of FunctionColumn.

abstract impls() List[FunctionImpl]

Returns the implementations associated with this definition.

abstract parameters() List[FunctionParam]

Returns the parameters for this definition.

Returns:

The parameters for this definition. May be an empty list for a no-arg definition.

return_columns() List[FunctionColumn]

The output columns for a table-valued function definition.

A table-valued function is a function that returns a table instead of a scalar value or an aggregate result. The returned table has a fixed schema defined by the columns returned from this method.

Returns:

The output columns that define the schema of the table returned by this definition, or an empty list if this is a scalar or aggregate function definition.

return_type() Type | None

The return type for scalar or aggregate function definitions.

Returns:

The return type, or None if this is a table-valued function definition.