You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "herodu (Jira)" <ji...@apache.org> on 2021/03/04 06:39:00 UTC

[jira] [Commented] (CALCITE-4521) Support User Defined Table-valued Function

    [ https://issues.apache.org/jira/browse/CALCITE-4521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17295031#comment-17295031 ] 

herodu commented on CALCITE-4521:
---------------------------------

[~amaliujia], [~danny0405]

> Support User Defined Table-valued Function
> ------------------------------------------
>
>                 Key: CALCITE-4521
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4521
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: herodu
>            Priority: Major
>
> It already support TUMBLE/HOP/SESSION windowing table-valued function in current version. But in fact, the table-valued function is not just the current features, so we want to support user defined table-valued function, just like the following query:
> {code:java}
> select * from table(UDTVF(table Shipments))
> {code}
> or
> {code:java}
> select * from table(UDTVF(select * from Shipments)){code}
> The input parameters of 'UDTVF' is the output rowtype of the inner subquery, and the output of 'UDTVF' is defined by users, just like: 
> {code:java}
> final TableValuedFunction tableValuedFunction =
>     (RelDataTypeFactory typeFactory) -> typeFactory.builder()
>         .add("in1", SqlTypeName.INTEGER)
>         .add("in2", SqlTypeName.VARCHAR)
>         .build();
> {code}
>  
> And the expected output logic plan like: 
> {code:java}
> LogicalProject(in1=[$0], in2=[$1])
>   LogicalTableFunctionScan(invocation=[UDTVF($0, $1)], rowType=[RecordType(INTEGER in1,VARCHAR in2)])
>     LogicalProject(ORDERID=[$0], ROWTIME=[$1])
>       LogicalTableScan(table=[[CATALOG, SALES, SHIPMENTS]])
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)