THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Their DDLs are “CREATE/DROP /ALTER TEMPORARY SYSTEM FUNCTION”.
...
Their DDLs are “CREATE/DROP /ALTER TEMPORARY SYSTEM FUNCTION”.
Lifespan of both types of temporary functions will be within a session, and will destroyed upon session end.
...
Code Block | ||
---|---|---|
| ||
private final Map<String, FunctionDefintion> tempSystemFunctions = new LinkedHashMap<>(); private final Map<ObjectIdentifier, FunctionDefintion> tempFunctions = new LinkedHashMap<>(); public void registerTemporarySystemScalarFunction(String name, ScalarFunction function) { // put into tempSystemFunctions } public void registerTemporarySystemTableFunction(String name, TableFunction function) { // put into tempSystemFunctions } public void registerTemporarySystemAggregateFunction(String name, AggregateFunction function) { // put into tempSystemFunctions } public void registerTemporaryScalarFunctiondropTemporarySystemFunction(ObjectIdentifier oi, ScalarFunction functionString name) { // put into tempFunctions } public void registerTemporarySystemTableFunctiondropTemporaryFunction(ObjectIdentifier oi, TableFunction function) { // put into tempFunctions } public void registerTemporarySystemAggregateFunction(ObjectIdentifier oi, AggregateFunction function) { // put into tempFunctions } public Optional<FunctionLookup.Result> lookupFunction(ObjectIdentifier oi) { if ((oi.getCatalogName().isPresent() && oi.getDatabaseName().isPresent()) || (!oi.getCatalogName().isPresent() && oi.getDatabaseName().isPresent())) { // resolvePreciseFunctionReference(oi); } if (!oi.getCatalogName().isPresent() && !oi.getDatabaseName().isPresent()) { resolveAmbiguousFunctionReference(oi.getObjectName()); } throw new IllegalArgumentException()/TableException(); } private Optional<FunctionLookup.Result> resolvePreciseFunctionReference(ObjectIdentifier oi) { // resolve order: // 1. Temporary functions // 2. Catalog functions } private Optional<FunctionLookup.Result> resolveAmbiguousFunctionReference(String name); // resolve order: // 1. Temporary system functions // 2. Builtin functions // 3. Temporary functions, in the current catalog/db // 2. Catalog functions, in the current catalog/db } |
...