Package org.apache.gravitino.function
Interface FunctionCatalog
The FunctionCatalog interface defines the public API for managing functions in a schema.
-
Method Summary
Modifier and TypeMethodDescriptionalterFunction(NameIdentifier ident, FunctionChange... changes) Applieschangesto a function in the catalog.booleandropFunction(NameIdentifier ident) Drop a function by name.default booleanfunctionExists(NameIdentifier ident) Check if a function with the given name exists in the catalog.getFunction(NameIdentifier ident) Get a function byNameIdentifierfrom the catalog.Function[]listFunctionInfos(Namespace namespace) List the functions with details in a namespace from the catalog.listFunctions(Namespace namespace) List the functions in a namespace from the catalog.registerFunction(NameIdentifier ident, String comment, FunctionType functionType, boolean deterministic, FunctionDefinition[] definitions) Register a function with one or more definitions (overloads).
-
Method Details
-
listFunctions
List the functions in a namespace from the catalog.- Parameters:
namespace- A namespace.- Returns:
- An array of function identifiers in the namespace.
- Throws:
NoSuchSchemaException- If the schema does not exist.
-
listFunctionInfos
List the functions with details in a namespace from the catalog.- Parameters:
namespace- A namespace.- Returns:
- An array of functions in the namespace.
- Throws:
NoSuchSchemaException- If the schema does not exist.
-
getFunction
Get a function byNameIdentifierfrom the catalog. The identifier only contains the schema and function name. A function may include multiple definitions (overloads) in the result.- Parameters:
ident- A function identifier.- Returns:
- The function with the given name.
- Throws:
NoSuchFunctionException- If the function does not exist.
-
functionExists
Check if a function with the given name exists in the catalog.- Parameters:
ident- The function identifier.- Returns:
- True if the function exists, false otherwise.
-
registerFunction
Function registerFunction(NameIdentifier ident, String comment, FunctionType functionType, boolean deterministic, FunctionDefinition[] definitions) throws NoSuchSchemaException, FunctionAlreadyExistsException 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).- Parameters:
ident- The function identifier.comment- The optional function comment.functionType- 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.
- Throws:
NoSuchSchemaException- If the schema does not exist.FunctionAlreadyExistsException- If the function already exists.
-
alterFunction
Function alterFunction(NameIdentifier ident, FunctionChange... changes) throws NoSuchFunctionException, IllegalArgumentException Applieschangesto a function in the catalog.Implementations may reject the changes. If any change is rejected, no changes should be applied to the function.
- Parameters:
ident- theNameIdentifierinstance of the function to alter.changes- the severalFunctionChangeinstances to apply to the function.- Returns:
- the updated
Functioninstance. - Throws:
NoSuchFunctionException- If the function does not exist.IllegalArgumentException- If the change is rejected by the implementation.
-
dropFunction
Drop a function by name.- Parameters:
ident- The name identifier of the function.- Returns:
- True if the function is deleted, false if the function does not exist.
-