You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vladimir Steshin (Jira)" <ji...@apache.org> on 2025/01/28 19:50:00 UTC
[jira] [Updated] (IGNITE-24336) Calcite. Add support of user-defined table functions.
[ https://issues.apache.org/jira/browse/IGNITE-24336?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vladimir Steshin updated IGNITE-24336:
--------------------------------------
Description:
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.
was:
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.
> 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
> Priority: Major
>
> 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)