Page properties | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
private
final
Map<ObjectIdentifier, FunctionDefintion> tempFunctions =
new
LinkedHashMap<>();
Status
Current state: Under Discussion
Discussion thread: http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/DISCUSS-FLIP-57-Rework-FunctionCatalog-td32291.html#a32613
JIRA: FLINK-14090
...
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
...
This FLIP would add explicit temporary function support by renaming a few variable names, and potential deprecating renaming some APIs in favor of new APIs that reflects their nature of dealing with temporary functions.
...
We will first clarify the dimensions of functions.
System (can be used interchangeably with "builtin") | Catalog | |
---|---|---|
Non-Temporary | system functions | catalog functions |
Temporary | temporary system functions | temporary catalog functions |
1. Support Two Types of Temporary Functions
...
Their DDLs are “CREATE/DROP TEMPORARY SYSTEM FUNCTION”.
Existing They will be renamed from “registerScalar/Table/AggregateFunctions()” will be deprecated in favor of the new APIs”.
b) Temporary Catalog Functions
...
Code Block | ||
---|---|---|
| ||
Class FunctionIdentifier { // for temporary/non-temporary system function // for temporary/non-temporary catalog function ObjectIdentifier oi; Optional<ObjectIdentifier> getIdentifier() {} Optional<String> getSimpleName( getName() {} Optional<FunctionIdentifier> of(ObjectIdentifier oi) {} Optional<FunctionIdentifier> of(String name) {} } |
Changes to CallExpression and UnresolvedCallExpression
...
Code Block | ||
---|---|---|
| ||
private final Map<String, FunctionDefintion> tempSystemFunctions = new LinkedHashMap<>(); private final Map<FunctionIdentifier, FunctionDefinition> tempFunctions = new LinkedHashMap<>(); public void registerTemporarySystemScalarFunctionregisterTempSystemScalarFunction(String name, ScalarFunction function) { // put into tempSystemFunctions } public void registerTemporarySystemTableFunctionregisterTempSystemTableFunction(String name, TableFunction function) { // put into tempSystemFunctions } public void registerTemporarySystemAggregateFunctionregisterTempSystemAggregateFunction(String name, AggregateFunction function) { // put into tempSystemFunctions } public void registerTemporaryScalarFunctionregisterTempCatalogScalarFunction(ObjectIdentifier foi, ScalarFunction function) { // put into tempFunctions } public void registerTemporaryTableFunctionregisterTempCatalogTableFunction(ObjectIdentifier fi, TableFunction function) { // put into tempFunctions } public void registerTemporaryAggregateFunctionregisterTempCatalogAggregateFunction(ObjectIdentifier fi, AggregateFunction function) { // put into tempFunctions } public void dropTemporarySystemFunction(String name) {} public void dropTemporaryFunctiondropTemporaryCatalogFunction(FunctionIdentifier fi) {} public Optional<FunctionLookup.Result> lookupFunction(FunctionIdentifier fi) { if (fi.getObjectIdentifier().isPresent()) { // resolvePreciseFunctionReference(fi.getObjectIdentifier()); } else { resolveAmbiguousFunctionReference(fi.getName()); } } private Optional<FunctionLookup.Result> resolvePreciseFunctionReference(FunctionIdentifier fi) { // 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 } |
...