[ https://issues.apache.org/jira/browse/CALCITE-4521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17299339#comment-17299339 ]
Danny Chen commented on CALCITE-4521: ------------------------------------- I guess this issue is not about UDTF but UDTVF, which is a little different, the latter can pass in table name as parameters and has solid schema. > 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, and 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)