@Experimental public interface FunctionNamespaceManager<F extends SqlFunction>
| Modifier and Type | Method and Description |
|---|---|
void |
abort(FunctionNamespaceTransactionHandle transactionHandle)
Rollback the transaction.
|
void |
addUserDefinedType(UserDefinedType userDefinedType) |
void |
alterFunction(QualifiedObjectName functionName,
Optional<List<TypeSignature>> parameterTypes,
AlterRoutineCharacteristics alterRoutineCharacteristics)
Alter the specified function.
|
FunctionNamespaceTransactionHandle |
beginTransaction()
Start a transaction.
|
default boolean |
canResolveFunction()
Whether this function namespace manager would do function resolution or not.
|
void |
commit(FunctionNamespaceTransactionHandle transactionHandle)
Commit the transaction.
|
void |
createFunction(SqlInvokedFunction function,
boolean replace)
Create or replace the specified function.
|
void |
dropFunction(QualifiedObjectName functionName,
Optional<List<TypeSignature>> parameterTypes,
boolean exists)
Drop the specified function.
|
CompletableFuture<SqlFunctionResult> |
executeFunction(String source,
FunctionHandle functionHandle,
Page input,
List<Integer> channels,
TypeManager typeManager) |
default AggregationFunctionImplementation |
getAggregateFunctionImplementation(FunctionHandle functionHandle) |
FunctionHandle |
getFunctionHandle(Optional<? extends FunctionNamespaceTransactionHandle> transactionHandle,
Signature signature) |
FunctionMetadata |
getFunctionMetadata(FunctionHandle functionHandle) |
Collection<F> |
getFunctions(Optional<? extends FunctionNamespaceTransactionHandle> transactionHandle,
QualifiedObjectName functionName) |
ScalarFunctionImplementation |
getScalarFunctionImplementation(FunctionHandle functionHandle) |
Optional<UserDefinedType> |
getUserDefinedType(QualifiedObjectName typeName) |
Collection<F> |
listFunctions(Optional<String> likePattern,
Optional<String> escape)
List all functions managed by the
FunctionNamespaceManager. |
default FunctionHandle |
resolveFunction(Optional<? extends FunctionNamespaceTransactionHandle> transactionHandle,
QualifiedObjectName functionName,
List<TypeSignature> parameterTypes)
When
canResolveFunction() returns true, this function is called to resolve the function to a function handle. |
void |
setBlockEncodingSerde(BlockEncodingSerde blockEncodingSerde)
BlockEncodingSerde might be needed to serialize/deserialize Presto pages when running external functions.
|
void setBlockEncodingSerde(BlockEncodingSerde blockEncodingSerde)
FunctionNamespaceTransactionHandle beginTransaction()
void commit(FunctionNamespaceTransactionHandle transactionHandle)
abort(FunctionNamespaceTransactionHandle) is called.void abort(FunctionNamespaceTransactionHandle transactionHandle)
commit(FunctionNamespaceTransactionHandle) is called.void createFunction(SqlInvokedFunction function, boolean replace)
void alterFunction(QualifiedObjectName functionName, Optional<List<TypeSignature>> parameterTypes, AlterRoutineCharacteristics alterRoutineCharacteristics)
void dropFunction(QualifiedObjectName functionName, Optional<List<TypeSignature>> parameterTypes, boolean exists)
Collection<F> listFunctions(Optional<String> likePattern, Optional<String> escape)
FunctionNamespaceManager.
likePattern and escape are from `SHOW FUNCTIONS LIKE [likePattern] escape [escape]`.
Backends supporting like pattern / escape matching can use this to prefilter functions, but Presto will filter again, so it is fine if the backend doesn't
use these parameters.
TODO: Support transactiondefault boolean canResolveFunction()
getFunctions(Optional, QualifiedObjectName)
to get all candidates, and use engine logic to resolve to a specific function signature, then call getFunctionHandle(Optional, Signature)
to get the function handle.
If returns true, the function resolution logic will be delegated to the function namespace manager, and the engine
will call resolveFunction(Optional, QualifiedObjectName, List) directly to get the function handle.default FunctionHandle resolveFunction(Optional<? extends FunctionNamespaceTransactionHandle> transactionHandle, QualifiedObjectName functionName, List<TypeSignature> parameterTypes)
canResolveFunction() returns true, this function is called to resolve the function to a function handle.
This is useful for plugins like Hive functions because the function resolution logic is defined with the function itself.Collection<F> getFunctions(Optional<? extends FunctionNamespaceTransactionHandle> transactionHandle, QualifiedObjectName functionName)
FunctionHandle getFunctionHandle(Optional<? extends FunctionNamespaceTransactionHandle> transactionHandle, Signature signature)
FunctionMetadata getFunctionMetadata(FunctionHandle functionHandle)
ScalarFunctionImplementation getScalarFunctionImplementation(FunctionHandle functionHandle)
CompletableFuture<SqlFunctionResult> executeFunction(String source, FunctionHandle functionHandle, Page input, List<Integer> channels, TypeManager typeManager)
void addUserDefinedType(UserDefinedType userDefinedType)
Optional<UserDefinedType> getUserDefinedType(QualifiedObjectName typeName)
default AggregationFunctionImplementation getAggregateFunctionImplementation(FunctionHandle functionHandle)
Copyright © 2012–2022. All rights reserved.