public class FunctionImplementationRegistry extends Object implements FunctionLookupContext, AutoCloseable
LocalFunctionRegistry
), other PluggableFunctionRegistry (e.g.,
HiveFunctionRegistry
) is also
registered in this classConstructor and Description |
---|
FunctionImplementationRegistry(DrillConfig config) |
FunctionImplementationRegistry(DrillConfig config,
ScanResult classpathScan) |
FunctionImplementationRegistry(DrillConfig config,
ScanResult classpathScan,
OptionManager optionManager) |
FunctionImplementationRegistry(DrillConfig config,
ScanResult classpathScan,
OptionSet optionManager) |
Modifier and Type | Method and Description |
---|---|
void |
close()
If
deleteTmpDir is set to true, deletes generated temporary directory. |
DrillFuncHolder |
findDrillFunction(FunctionResolver functionResolver,
FunctionCall functionCall)
First attempts to find the Drill function implementation that matches the name, arg types and return type.
|
DrillFuncHolder |
findExactMatchingDrillFunction(String name,
List<TypeProtos.MajorType> argTypes,
TypeProtos.MajorType returnType)
Finds the Drill function implementation that matches the name, arg types and return type.
|
AbstractFuncHolder |
findNonDrillFunction(FunctionCall functionCall)
Find function implementation for given
functionCall in non-Drill function registries such as Hive UDF
registry. |
Map<String,List<FunctionHolder>> |
getAllJarsWithFunctionsHolders()
Retrieve all functions, mapped by source jars (after syncing)
|
LocalFunctionRegistry |
getLocalFunctionRegistry() |
RemoteFunctionRegistry |
getRemoteFunctionRegistry() |
boolean |
isFunctionComplexOutput(String name) |
void |
register(DrillOperatorTable operatorTable)
Register functions in given operator table.
|
boolean |
syncWithRemoteRegistry(int version)
Purpose of this method is to synchronize remote and local function registries if needed
and to inform if function registry was changed after given version.
|
List<String> |
validate(org.apache.hadoop.fs.Path path)
Using given local path to jar creates unique class loader for this jar.
|
public FunctionImplementationRegistry(DrillConfig config)
public FunctionImplementationRegistry(DrillConfig config, ScanResult classpathScan)
public FunctionImplementationRegistry(DrillConfig config, ScanResult classpathScan, OptionManager optionManager)
public FunctionImplementationRegistry(DrillConfig config, ScanResult classpathScan, OptionSet optionManager)
public void register(DrillOperatorTable operatorTable)
operatorTable
- operator tablepublic DrillFuncHolder findDrillFunction(FunctionResolver functionResolver, FunctionCall functionCall)
functionResolver
.findDrillFunction
in interface FunctionLookupContext
functionResolver
- function resolverfunctionCall
- function callpublic DrillFuncHolder findExactMatchingDrillFunction(String name, List<TypeProtos.MajorType> argTypes, TypeProtos.MajorType returnType)
name
- function nameargTypes
- input parameters typesreturnType
- function return typepublic AbstractFuncHolder findNonDrillFunction(FunctionCall functionCall)
functionCall
in non-Drill function registries such as Hive UDF
registry.
Note: Order of searching is same as order of PluggableFunctionRegistry
implementations found on classpath.findNonDrillFunction
in interface FunctionLookupContext
functionCall
- function callpublic boolean isFunctionComplexOutput(String name)
public LocalFunctionRegistry getLocalFunctionRegistry()
public RemoteFunctionRegistry getRemoteFunctionRegistry()
public List<String> validate(org.apache.hadoop.fs.Path path) throws IOException
path
- local path to jar we need to validateIOException
public boolean syncWithRemoteRegistry(int version)
JarScan
.
Once jar download is finished, all missing jars are registered in one batch.
In case if any errors during jars download / registration, these errors are logged.
During registration local function registry is updated with remote function registry version it is synced with.
When at least one jar of the missing jars failed to download / register,
local function registry version are not updated but jars that where successfully downloaded / registered
are added to local function registry.
If synchronization between remote and local function registry was not needed,
checks if given registry version matches latest sync version
to inform if function registry was changed after given version.version
- remote function registry local function registry was based onpublic Map<String,List<FunctionHolder>> getAllJarsWithFunctionsHolders()
public void close()
deleteTmpDir
is set to true, deletes generated temporary directory.
Otherwise cleans up localUdfDir
.close
in interface AutoCloseable
Copyright © 1970 The Apache Software Foundation. All rights reserved.