Package org.apache.flink.table.catalog
Class FunctionCatalog
- java.lang.Object
-
- org.apache.flink.table.catalog.FunctionCatalog
-
@Internal public final class FunctionCatalog extends Object
Simple function catalog to storeFunctionDefinition
s 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
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FunctionCatalog.InlineCatalogFunction
The CatalogFunction which holds an instantiated UDF.
-
Constructor Summary
Constructors Constructor Description FunctionCatalog(ReadableConfig config, ResourceManager resourceManager, CatalogManager catalogManager, ModuleManager moduleManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description FunctionLookup
asLookup(Function<String,UnresolvedIdentifier> parser)
Creates aFunctionLookup
to thisFunctionCatalog
.FunctionCatalog
copy(ResourceManager newResourceManager)
boolean
dropCatalogFunction(UnresolvedIdentifier unresolvedIdentifier, boolean ignoreIfNotExist)
Drops a catalog function by also considering temporary catalog functions.CatalogFunction
dropTempCatalogFunction(ObjectIdentifier identifier, boolean ignoreIfNotExist)
Drop a temporary catalog function.boolean
dropTemporaryCatalogFunction(UnresolvedIdentifier unresolvedIdentifier, boolean ignoreIfNotExist)
Drops a temporary catalog function.boolean
dropTemporarySystemFunction(String name, boolean ignoreIfNotExist)
Drops a temporary system function.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.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.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.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.boolean
hasTemporaryCatalogFunction(ObjectIdentifier functionIdentifier)
Check whether a temporary catalog function is already registered.boolean
hasTemporarySystemFunction(String functionName)
Check whether a temporary system function is already registered.Optional<ContextResolvedFunction>
lookupFunction(UnresolvedIdentifier identifier)
Optional<ContextResolvedProcedure>
lookupProcedure(UnresolvedIdentifier identifier)
void
registerCatalogFunction(UnresolvedIdentifier unresolvedIdentifier, Class<? extends UserDefinedFunction> functionClass, boolean ignoreIfExists)
Registers a catalog function by also considering temporary catalog functions.void
registerCatalogFunction(UnresolvedIdentifier unresolvedIdentifier, String className, List<ResourceUri> resourceUris, boolean ignoreIfExists)
void
registerFunctionJarResources(String functionName, List<ResourceUri> resourceUris)
void
registerTempCatalogScalarFunction(ObjectIdentifier oi, ScalarFunction function)
Deprecated.void
registerTemporaryCatalogFunction(UnresolvedIdentifier unresolvedIdentifier, CatalogFunction catalogFunction, boolean ignoreIfExists)
Registers a uninstantiated temporary catalog function.void
registerTemporaryCatalogFunction(UnresolvedIdentifier unresolvedIdentifier, FunctionDefinition definition, boolean ignoreIfExists)
Registers a temporary catalog function.void
registerTemporarySystemFunction(String name, String className, List<ResourceUri> resourceUris)
Registers a temporary system function from resource uris.void
registerTemporarySystemFunction(String name, String fullyQualifiedName, FunctionLanguage language, boolean ignoreIfExists)
Registers a uninstantiated temporary system function.void
registerTemporarySystemFunction(String name, CatalogFunction function, boolean ignoreIfExists)
void
registerTemporarySystemFunction(String name, FunctionDefinition definition, boolean ignoreIfExists)
Registers a temporary system function.<T,ACC>
voidregisterTempSystemAggregateFunction(String name, ImperativeAggregateFunction<T,ACC> function, TypeInformation<T> resultType, TypeInformation<ACC> accType)
Deprecated.void
registerTempSystemScalarFunction(String name, ScalarFunction function)
Deprecated.<T> void
registerTempSystemTableFunction(String name, TableFunction<T> function, TypeInformation<T> resultType)
Deprecated.
-
-
-
Constructor Detail
-
FunctionCatalog
public FunctionCatalog(ReadableConfig config, ResourceManager resourceManager, CatalogManager catalogManager, ModuleManager moduleManager)
-
-
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.
-
registerCatalogFunction
public void registerCatalogFunction(UnresolvedIdentifier unresolvedIdentifier, String className, List<ResourceUri> resourceUris, boolean ignoreIfExists)
-
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
-
asLookup
public FunctionLookup asLookup(Function<String,UnresolvedIdentifier> parser)
Creates aFunctionLookup
to thisFunctionCatalog
.- Parameters:
parser
- parser to use for parsing identifiers
-
lookupProcedure
public Optional<ContextResolvedProcedure> lookupProcedure(UnresolvedIdentifier identifier)
-
lookupFunction
public Optional<ContextResolvedFunction> lookupFunction(UnresolvedIdentifier identifier)
-
registerTempSystemScalarFunction
@Deprecated public void registerTempSystemScalarFunction(String name, ScalarFunction function)
Deprecated.
-
registerTempSystemTableFunction
@Deprecated public <T> void registerTempSystemTableFunction(String name, TableFunction<T> function, TypeInformation<T> resultType)
Deprecated.
-
registerTempSystemAggregateFunction
@Deprecated public <T,ACC> void registerTempSystemAggregateFunction(String name, ImperativeAggregateFunction<T,ACC> function, TypeInformation<T> resultType, TypeInformation<ACC> accType)
Deprecated.
-
registerTempCatalogScalarFunction
@Deprecated public void registerTempCatalogScalarFunction(ObjectIdentifier oi, ScalarFunction function)
Deprecated.
-
dropTempCatalogFunction
public CatalogFunction dropTempCatalogFunction(ObjectIdentifier identifier, boolean ignoreIfNotExist)
Drop a temporary catalog function.- Parameters:
identifier
- identifier of the functionignoreIfNotExist
- 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)
-
copy
public FunctionCatalog copy(ResourceManager newResourceManager)
-
-