Vladimir Steshin created IGNITE-24336:
-----------------------------------------
Summary: Calcite. Add support of user-defined table functions.
Key: IGNITE-24336
URL: https://issues.apache.org/jira/browse/IGNITE-24336
Project: Ignite
Issue Type: Improvement
Reporter: Vladimir Steshin
Assignee: Vladimir Steshin
We should implement user-defined table functions. They also have a
implementation in Calcite, `_TableFunctionImpl_`. And we also have user-defined
scalar functions.
Table functions should be described similarly to the existing configuration of
scalar functions, via `_CacheConfiguration#setSqlFunctionClasses()_` and
annotation `_@QuerySqlTableFunction_`. Or we might use another annotation. The
annotation should describe the returned columns and their data types.
Example:
{code:java}
public static final class IncorrectTableFunctionsLibrary {
@QuerySqlFunction(tableColumnTypes = {Integer.class, String.class},
tableColumnNames = {"INT_COL", "STR_COL"})
public static Iterable duplicateColumnName(int i, String s) {
return Arrays.asList(
Arrays.asList(i, s + i),
Arrays.asList(i * 10, s + (i * 10))
);
}
}
{code}
Table function implementation must return an `Iterable` representing table
rows. Each its element is an `_Object[]_` or an `_Iterable_` representing a
table row. The number of row elements must match the number of the defined
columns.
*Known limitations*:
Only _Calcite_ engine will support table functions first.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)