Class LocalFunctionRegistry
java.lang.Object
org.apache.drill.exec.expr.fn.registry.LocalFunctionRegistry
- All Implemented Interfaces:
AutoCloseable
Registry of Drill functions.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionLocalFunctionRegistry
(ScanResult classpathScan) Registers all functions present in Drill classpath on start-up. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Returns list of jar names registered in function registry.Returns a map of all function holders mapped by source jarsgetMethods
(String name) getMethods
(String name, AtomicInteger version) int
void
Registers all functions present in jar and updates registry version.void
register
(DrillOperatorTable operatorTable) Registers all functions present inDrillOperatorTable
, also sets sync registry version used at the moment of function registration.int
size()
void
unregister
(String jarName) Removes all function associated with the given jar name.validate
(String jarName, ScanResult scanResult) Validates all functions, present in jars.
-
Field Details
-
BUILT_IN
- See Also:
-
-
Constructor Details
-
LocalFunctionRegistry
Registers all functions present in Drill classpath on start-up. All functions will be marked as built-in. Built-in functions are not allowed to be unregistered. Since local function registry version is based on remote function registry version, initially sync version will be set toDataChangeVersion.UNDEFINED
to ensure that upon first check both registries would be synchronized.
-
-
Method Details
-
getVersion
public int getVersion()- Returns:
- remote function registry version number with which local function registry is synced
-
validate
Validates all functions, present in jars. Will throwFunctionValidationException
if:- Jar with the same name has been already registered.
- Conflicting function with the similar signature is found.
- Aggregating function is not deterministic.
- Parameters:
jarName
- jar name to be validatedscanResult
- scan of all classes present in jar- Returns:
- list of validated function signatures
-
register
Registers all functions present in jar and updates registry version. If jar name is already registered, all jar related functions will be overridden. To prevent classpath collisions during loading and unloading jars, each jar is shipped with its own class loader.- Parameters:
jars
- list of jars to be registeredversion
- remote function registry version number with which local function registry is synced
-
unregister
Removes all function associated with the given jar name. Functions marked as built-in is not allowed to be unregistered. If user attempts to unregister built-in functions, logs warning and does nothing. Jar name is case-sensitive.- Parameters:
jarName
- jar name to be unregistered
-
getAllJarNames
Returns list of jar names registered in function registry.- Returns:
- list of jar names
-
size
public int size()- Returns:
- quantity of all registered functions
-
getMethods
- Parameters:
name
- function name- Returns:
- all function holders associated with the function name. Function name is case insensitive.
-
getMethods
- Parameters:
name
- function name- Returns:
- all function holders associated with the function name. Function name is case insensitive.
-
getAllJarsWithFunctionsHolders
Returns a map of all function holders mapped by source jars- Returns:
- all functions organized by source jars
-
register
Registers all functions present inDrillOperatorTable
, also sets sync registry version used at the moment of function registration.- Parameters:
operatorTable
- drill operator table
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-