Class FunctionCatalog


  • @Internal
    public final class FunctionCatalog
    extends Object
    Simple function catalog to store FunctionDefinitions in catalogs.

    Note: This class can be cleaned up a lot once we drop the methods deprecated as part of FLIP-65. In the long-term, the class should be a part of catalog manager similar to DataTypeFactory.

    • Method Detail

      • registerTemporarySystemFunction

        public void registerTemporarySystemFunction​(String name,
                                                    FunctionDefinition definition,
                                                    boolean ignoreIfExists)
        Registers a temporary system function.
      • registerTemporarySystemFunction

        public void registerTemporarySystemFunction​(String name,
                                                    String fullyQualifiedName,
                                                    FunctionLanguage language,
                                                    boolean ignoreIfExists)
        Registers a uninstantiated temporary system function.
      • registerTemporarySystemFunction

        public void registerTemporarySystemFunction​(String name,
                                                    String className,
                                                    List<ResourceUri> resourceUris)
        Registers a temporary system function from resource uris.
      • dropTemporarySystemFunction

        public boolean dropTemporarySystemFunction​(String name,
                                                   boolean ignoreIfNotExist)
        Drops a temporary system function. Returns true if a function was dropped.
      • registerTemporaryCatalogFunction

        public void registerTemporaryCatalogFunction​(UnresolvedIdentifier unresolvedIdentifier,
                                                     FunctionDefinition definition,
                                                     boolean ignoreIfExists)
        Registers a temporary catalog function.
      • registerTemporaryCatalogFunction

        public void registerTemporaryCatalogFunction​(UnresolvedIdentifier unresolvedIdentifier,
                                                     CatalogFunction catalogFunction,
                                                     boolean ignoreIfExists)
        Registers a uninstantiated temporary catalog function.
      • dropTemporaryCatalogFunction

        public boolean dropTemporaryCatalogFunction​(UnresolvedIdentifier unresolvedIdentifier,
                                                    boolean ignoreIfNotExist)
        Drops a temporary catalog function. Returns true if a function was dropped.
      • registerCatalogFunction

        public void registerCatalogFunction​(UnresolvedIdentifier unresolvedIdentifier,
                                            Class<? extends UserDefinedFunction> functionClass,
                                            boolean ignoreIfExists)
        Registers a catalog function by also considering temporary catalog functions.
      • dropCatalogFunction

        public boolean dropCatalogFunction​(UnresolvedIdentifier unresolvedIdentifier,
                                           boolean ignoreIfNotExist)
        Drops a catalog function by also considering temporary catalog functions. Returns true if a function was dropped.
      • getUserDefinedFunctions

        public String[] getUserDefinedFunctions()
        Get names of all user defined functions, including temp system functions, temp catalog functions and catalog functions in the current catalog and current database.
      • getUserDefinedFunctions

        public Set<FunctionIdentifier> getUserDefinedFunctions​(String catalogName,
                                                               String databaseName)
        Get names of all user including temp system functions, temp catalog * functions and catalog functions in the specified catalog and specified database.
      • getFunctions

        public String[] getFunctions()
        Get names of all functions, including temp system functions, system functions, temp catalog functions and catalog functions in the current catalog and current database.
      • getFunctions

        public String[] getFunctions​(String catalogName,
                                     String databaseName)
        Get names of all functions, including temp system functions, system functions, temp catalog functions and catalog functions with specific catalog and database.
      • hasTemporaryCatalogFunction

        public boolean hasTemporaryCatalogFunction​(ObjectIdentifier functionIdentifier)
        Check whether a temporary catalog function is already registered.
        Parameters:
        functionIdentifier - the object identifier of function
        Returns:
        whether the temporary catalog function exists in the function catalog
      • hasTemporarySystemFunction

        public boolean hasTemporarySystemFunction​(String functionName)
        Check whether a temporary system function is already registered.
        Parameters:
        functionName - the name of the function
        Returns:
        whether the temporary system function exists in the function catalog
      • dropTempCatalogFunction

        public CatalogFunction dropTempCatalogFunction​(ObjectIdentifier identifier,
                                                       boolean ignoreIfNotExist)
        Drop a temporary catalog function.
        Parameters:
        identifier - identifier of the function
        ignoreIfNotExist - Flag to specify behavior when the function does not exist: if set to false, throw an exception, if set to true, do nothing.
        Returns:
        the removed catalog function, which is null if function doesn't exist and ignoreIfNotExist is true.
      • registerTemporarySystemFunction

        public void registerTemporarySystemFunction​(String name,
                                                    CatalogFunction function,
                                                    boolean ignoreIfExists)
      • registerFunctionJarResources

        public void registerFunctionJarResources​(String functionName,
                                                 List<ResourceUri> resourceUris)