Class FunctionCatalog

java.lang.Object
org.apache.flink.table.catalog.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.

  • Constructor Details

  • Method Details

    • registerTemporarySystemFunction

      public void registerTemporarySystemFunction(String name, org.apache.flink.table.functions.FunctionDefinition definition, boolean ignoreIfExists)
      Registers a temporary system function.
    • registerTemporarySystemFunction

      public void registerTemporarySystemFunction(String name, String fullyQualifiedName, org.apache.flink.table.catalog.FunctionLanguage language, boolean ignoreIfExists)
      Registers a uninstantiated temporary system function.
    • registerTemporarySystemFunction

      public void registerTemporarySystemFunction(String name, String className, List<org.apache.flink.table.resource.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(org.apache.flink.table.catalog.UnresolvedIdentifier unresolvedIdentifier, org.apache.flink.table.functions.FunctionDefinition definition, boolean ignoreIfExists)
      Registers a temporary catalog function.
    • registerTemporaryCatalogFunction

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

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

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

      public void registerCatalogFunction(org.apache.flink.table.catalog.UnresolvedIdentifier unresolvedIdentifier, String className, List<org.apache.flink.table.resource.ResourceUri> resourceUris, boolean ignoreIfExists)
    • dropCatalogFunction

      public boolean dropCatalogFunction(org.apache.flink.table.catalog.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<org.apache.flink.table.functions.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(org.apache.flink.table.catalog.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
    • asLookup

      public FunctionLookup asLookup(Function<String,org.apache.flink.table.catalog.UnresolvedIdentifier> parser)
      Creates a FunctionLookup to this FunctionCatalog.
      Parameters:
      parser - parser to use for parsing identifiers
    • lookupProcedure

      public Optional<ContextResolvedProcedure> lookupProcedure(org.apache.flink.table.catalog.UnresolvedIdentifier identifier)
    • lookupFunction

      public Optional<ContextResolvedFunction> lookupFunction(org.apache.flink.table.catalog.UnresolvedIdentifier identifier)
    • registerTempSystemScalarFunction

      @Deprecated public void registerTempSystemScalarFunction(String name, org.apache.flink.table.functions.ScalarFunction function)
    • registerTempSystemTableFunction

      @Deprecated public <T> void registerTempSystemTableFunction(String name, org.apache.flink.table.functions.TableFunction<T> function, org.apache.flink.api.common.typeinfo.TypeInformation<T> resultType)
    • registerTempSystemAggregateFunction

      @Deprecated public <T, ACC> void registerTempSystemAggregateFunction(String name, org.apache.flink.table.functions.ImperativeAggregateFunction<T,ACC> function, org.apache.flink.api.common.typeinfo.TypeInformation<T> resultType, org.apache.flink.api.common.typeinfo.TypeInformation<ACC> accType)
    • registerTempCatalogScalarFunction

      @Deprecated public void registerTempCatalogScalarFunction(org.apache.flink.table.catalog.ObjectIdentifier oi, org.apache.flink.table.functions.ScalarFunction function)
    • dropTempCatalogFunction

      public org.apache.flink.table.catalog.CatalogFunction dropTempCatalogFunction(org.apache.flink.table.catalog.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, org.apache.flink.table.catalog.CatalogFunction function, boolean ignoreIfExists)
    • registerFunctionJarResources

      public void registerFunctionJarResources(String functionName, List<org.apache.flink.table.resource.ResourceUri> resourceUris)
    • copy

      public FunctionCatalog copy(ResourceManager newResourceManager)