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

Julian Hyde commented on CALCITE-3955:
--------------------------------------

That doesn't seem right.

A table function is just a (Java) function, not a relational operator. So its 
input relation(s) should appear explicitly as arguments, wrapped as {{CURSOR}} 
objects. See 
[RelBuilderTest|https://github.com/apache/calcite/blob/9492dd4146f63ddc028010d6c4e86f6a5cb29a8d/core/src/test/java/org/apache/calcite/test/RelBuilderTest.java#L327-L355].

In future -- and perhaps already, although I couldn't find any tests for this 
-- we might allow table functions that have multiple outputs, and these would 
appear as arguments to the table function of type java.sql.PreparedStatement. 
So we should operate in the mindset that table functions can have arguments for 
inputs and outputs. But definitely for inputs.

As for the descriptor, I'm not sure. It might be sufficient to pass a reference 
to the particular field, that is, a RexInputRef. If the function needs to know 
more about that column - e.g. its name and ordinal, in addition to just its 
value - then it can probably get it from the RexInputRef.

> Remove the first operand of RexCall from SqlWindowTableFunction
> ---------------------------------------------------------------
>
>                 Key: CALCITE-3955
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3955
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.22.0
>            Reporter: Danny Chen
>            Assignee: Danny Chen
>            Priority: Major
>             Fix For: 1.23.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> In CALCITE-3382, we introduced TUMBLE window function to replace the 
> deprecated group tumble window.
> But for query
> {code:sql}
> select *
> from table(tumble(table Shipments, descriptor(rowtime), INTERVAL '1' MINUTE))
> {code}
> the outputs plan is
> {code:xml}
> LogicalProject(ORDERID=[$0], ROWTIME=[$1], window_start=[$2], window_end=[$3])
>   LogicalTableFunctionScan(invocation=[TUMBLE($1, DESCRIPTOR($1), 
> 60000:INTERVAL MINUTE)], rowType=[RecordType(INTEGER ORDERID, TIMESTAMP(0) 
> ROWTIME, TIMESTAMP(0) window_start, TIMESTAMP(0) window_end)])
>     LogicalProject(ORDERID=[$0], ROWTIME=[$1])
>       LogicalTableScan(table=[[CATALOG, SALES, SHIPMENTS]])
> {code}
> The first operand of TUMBLE rex call is always the last input field, but 
> actually it represents the source table which is the input rel node.
> This issue remove the first operand from the RexCall because it is useless 
> and confusing.



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

Reply via email to