Package org.apache.flink.table.module
Class ModuleManager
java.lang.Object
org.apache.flink.table.module.ModuleManager
Responsible for loading/unloading modules, managing their life cycles, and resolving module
objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends org.apache.flink.table.factories.Factory>
Optional<T>getFactory(Function<org.apache.flink.table.module.Module, Optional<T>> selector) Returns the first factory found in the loaded modules given a selector.Optional<org.apache.flink.table.functions.FunctionDefinition>getFunctionDefinition(String name) Get an optional ofFunctionDefinitionby a given name.Get all loaded modules with use status.Get names of all functions from used modules.Get names of all used modules in resolution order.voidloadModule(String name, org.apache.flink.table.module.Module module) Load a module under a unique name.voidunloadModule(String name) Unload a module with given name.voiduseModules(String... names) Enable modules in use with declared name order.
-
Constructor Details
-
ModuleManager
public ModuleManager()
-
-
Method Details
-
loadModule
Load a module under a unique name. Modules will be kept in the loaded order, and new module will be added to the left before the unused module and turn on use by default.- Parameters:
name- name of the modulemodule- the module instance- Throws:
org.apache.flink.table.api.ValidationException- when there already exists a module with the same name
-
unloadModule
Unload a module with given name.- Parameters:
name- name of the module- Throws:
org.apache.flink.table.api.ValidationException- when there is no module with the given name
-
useModules
Enable modules in use with declared name order. Modules that have been loaded but not exist in names varargs will become unused.- Parameters:
names- module names to be used- Throws:
org.apache.flink.table.api.ValidationException- when module names contain an unloaded name
-
listModules
Get names of all used modules in resolution order.- Returns:
- a list of names of used modules
-
listFullModules
Get all loaded modules with use status. Modules in use status are returned in resolution order.- Returns:
- a list of module entries with module name and use status
-
listFunctions
Get names of all functions from used modules. It excludes hidden functions.- Returns:
- a set of function names of used modules
-
getFunctionDefinition
public Optional<org.apache.flink.table.functions.FunctionDefinition> getFunctionDefinition(String name) Get an optional ofFunctionDefinitionby a given name. Function will be resolved to modules in the used order, and the first match will be returned. If no match is found in all modules, return an optional.It includes hidden functions even though not listed in
listFunctions().- Parameters:
name- name of the function- Returns:
- an optional of
FunctionDefinition
-
getFactory
public <T extends org.apache.flink.table.factories.Factory> Optional<T> getFactory(Function<org.apache.flink.table.module.Module, Optional<T>> selector) Returns the first factory found in the loaded modules given a selector.Modules are checked in the order in which they have been loaded. The first factory returned by a module will be used. If no loaded module provides a factory,
Optional.empty()is returned.
-