Package dev.frostlake.functions
Class FunctionRegistry
java.lang.Object
dev.frostlake.functions.FunctionRegistry
-
Constructor Summary
ConstructorsConstructorDescriptionFunctionRegistry(Catalog catalog) FunctionRegistry(Catalog catalog, SessionContext sessionContext) FunctionRegistry(Catalog catalog, SessionContext sessionContext, EngineConfig config) -
Method Summary
Modifier and TypeMethodDescriptionThe list of built-in names this engine can dispatch — the single sourceSHOW FUNCTIONSandSHOW BUILTIN FUNCTIONSenumerate, so a listing and a working call can no longer disagree.getAggregateFunction(String name) The catalog this registry's functions read metadata from, for aFunctionProviderwhose pack contributes a catalog-aware function.getFunction(String name) The session a pack's function answers for — the current role, database and schema.getTableFunction(String name) booleanhasAggregateFunction(String name) booleanhasFunction(String name) booleanhasTableFunction(String name) voidregister(BuiltInFunction function) voidregisterAggregate(AggregateFunction function) voidregisterAlias(String name, BuiltInFunction function) Registers an alias name for an already-constructed function (used by FunctionProviders).voidregisterTableFunction(TableFunction function) voidsetQueryRunner(QueryRunner runner) How a pack's function runs SQL of its own.voidsetTaskScheduler(TaskScheduler taskScheduler) Hands the task scheduler to the built-ins that need it.
-
Constructor Details
-
FunctionRegistry
-
FunctionRegistry
-
FunctionRegistry
-
-
Method Details
-
registerAlias
Registers an alias name for an already-constructed function (used by FunctionProviders). -
register
-
registerAggregate
-
registerTableFunction
-
getCatalog
The catalog this registry's functions read metadata from, for aFunctionProviderwhose pack contributes a catalog-aware function. The engine's own such built-ins (GET_DDL, the INFORMATION_SCHEMA-adjacent context functions) are handed it at construction; a pack sees the registry and nothing else, so it asks here. -
getSessionContext
The session a pack's function answers for — the current role, database and schema. -
setQueryRunner
How a pack's function runs SQL of its own. Installed by the executor once it exists — the registry is built first — so a function that needs it holds the REGISTRY and asks at call time rather than capturing a runner it would have been handed as null. -
getQueryRunner
-
setTaskScheduler
Hands the task scheduler to the built-ins that need it. The scheduler is constructed after this registry, so it arrives here rather than through a constructor. -
getFunction
-
getAggregateFunction
-
getTableFunction
-
hasFunction
-
hasAggregateFunction
-
hasTableFunction
-
getAllFunctions
-
getAllAggregateFunctions
-
getAllTableFunctions
-
allDispatchableNames
The list of built-in names this engine can dispatch — the single sourceSHOW FUNCTIONSandSHOW BUILTIN FUNCTIONSenumerate, so a listing and a working call can no longer disagree.It is the union of six families, each contributed by the very structure the dispatcher consults:
- the scalar map's keys — keys, not
getAllFunctions()values, because an alias such asSUBSTRis a second key onto aSubstringinstance whoseBuiltInFunction.getName()still answersSUBSTRING. Enumerating values listedSUBSTRINGtwice andSUBSTRnever; - the aggregate map's keys (same alias story:
ARRAYAGG,BIT_OR_AGG, …); - the table-function map's keys;
WindowFunctionNames— window functions live inWindowFunctionEvaluator, never in these maps;HigherOrderFunctionNames— TRANSFORM / FILTER / REDUCE are taken byExpressionEvaluatorVisitorbefore the registry lookup;SystemFunctionNamesandOperatorFunctionNames— evaluated by theSYSTEM$evaluators and by the grammar respectively.
The first three families cannot drift because the listing reads the same maps
getFunction/getAggregateFunction/getTableFunctionresolve against; the next three cannot drift because their dispatchers reject names those sets do not declare. OnlyOperatorFunctionNamesis curated, and its entries are re-verified by test.- Returns:
- every dispatchable built-in name, upper-cased and sorted; never null
- the scalar map's keys — keys, not
-