Interface FunctionCatalog


@Evolving public interface FunctionCatalog
The FunctionCatalog interface defines the public API for managing functions in a schema.
  • Method Details

    • listFunctions

      NameIdentifier[] listFunctions(Namespace namespace) throws NoSuchSchemaException
      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

      Function[] listFunctionInfos(Namespace namespace) throws NoSuchSchemaException
      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

      Function getFunction(NameIdentifier ident) throws NoSuchFunctionException
      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.
      Parameters:
      ident - A function identifier.
      Returns:
      The function with the given name.
      Throws:
      NoSuchFunctionException - If the function does not exist.
    • functionExists

      default boolean functionExists(NameIdentifier ident)
      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

      Applies 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.

      Parameters:
      ident - the NameIdentifier instance of the function to alter.
      changes - the several FunctionChange instances to apply to the function.
      Returns:
      the updated Function instance.
      Throws:
      NoSuchFunctionException - If the function does not exist.
      IllegalArgumentException - If the change is rejected by the implementation.
    • dropFunction

      boolean dropFunction(NameIdentifier ident)
      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.