gravitino.api.function.function_catalog.FunctionCatalog¶
- class gravitino.api.function.function_catalog.FunctionCatalog¶
Bases:
ABCThe FunctionCatalog interface defines the public API for managing functions in a schema.
- __init__()¶
Methods
__init__()alter_function(ident, *changes)Applies FunctionChange changes to a function in the catalog.
drop_function(ident)Drop a function by name.
function_exists(ident)Check if a function with the given name exists in the catalog.
get_function(ident)Get a function by NameIdentifier from the catalog.
list_function_infos(namespace)List the functions with details in a namespace from the catalog.
list_functions(namespace)List the functions in a namespace from the catalog.
register_function(ident, comment, ...)Register a function with one or more definitions (overloads).
- abstract alter_function(ident: NameIdentifier, *changes: FunctionChange) Function¶
Applies FunctionChange changes to a function in the catalog.
Implementations may reject the changes. If any change is rejected, no changes should be applied to the function.
- Args:
ident: The NameIdentifier instance of the function to alter. changes: The FunctionChange instances to apply to the function.
- Returns:
The updated Function instance.
- Raises:
NoSuchFunctionException: If the function does not exist. IllegalArgumentException: If the change is rejected by the implementation.
- abstract drop_function(ident: NameIdentifier) bool¶
Drop a function by name.
- Args:
ident: The name identifier of the function.
- Returns:
True if the function is deleted, False if the function does not exist.
- function_exists(ident: NameIdentifier) bool¶
Check if a function with the given name exists in the catalog.
- Args:
ident: The function identifier.
- Returns:
True if the function exists, False otherwise.
- abstract get_function(ident: NameIdentifier) Function¶
Get a function by NameIdentifier from the catalog.
The identifier only contains the schema and function name. A function may include multiple definitions (overloads) in the result.
- Args:
ident: A function identifier.
- Returns:
The function with the given name.
- Raises:
NoSuchFunctionException: If the function does not exist.
- abstract list_function_infos(namespace: Namespace) List[Function]¶
List the functions with details in a namespace from the catalog.
- Args:
namespace: A namespace.
- Returns:
A list of functions in the namespace.
- Raises:
NoSuchSchemaException: If the schema does not exist.
- abstract list_functions(namespace: Namespace) List[NameIdentifier]¶
List the functions in a namespace from the catalog.
- Args:
namespace: A namespace.
- Returns:
A list of function identifiers in the namespace.
- Raises:
NoSuchSchemaException: If the schema does not exist.
- abstract register_function(ident: NameIdentifier, comment: str | None, function_type: FunctionType, deterministic: bool, definitions: List[FunctionDefinition]) Function¶
Register a function with one or more definitions (overloads).
Each definition contains its own return type (for scalar/aggregate functions) or return columns (for table-valued functions).
- Args:
ident: The function identifier. comment: The optional function comment. function_type: The function type (SCALAR, AGGREGATE, or TABLE). deterministic: Whether the function is deterministic. definitions: The function definitions, each containing parameters,
return type/columns, and implementations.
- Returns:
The registered function.
- Raises:
NoSuchSchemaException: If the schema does not exist. FunctionAlreadyExistsException: If the function already exists.