You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Chunwei Lei (JIRA)" <ji...@apache.org> on 2019/03/11 12:56:00 UTC

[jira] [Comment Edited] (CALCITE-1515) Support TableFunctionScan in RelBuilder

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

Chunwei Lei edited comment on CALCITE-1515 at 3/11/19 12:55 PM:
----------------------------------------------------------------

Hi [~julianhyde] [~anmu]
I opened a pull request: https://github.com/apache/calcite/pull/1102.

Though I think the signature is convenient, I am not sure whether it is proper which is as follows:

{code:java}
RelBuilder functionScan(
    SqlOperator operator,
    Iterable<? extends RexNode> operands);

RexNode cursor(int ordinal);
{code}

I also add a test in RelBuilderTest as follows:
{code:java}
    // Equivalent SQL:
    //   SELECT *
    //   FROM TABLE(DUP(CURSOR(select * from emp), CURSOR(select * from DEPT), 'NAME'))
    final RelBuilder builder = RelBuilder.create(config().build());
    RelNode root = builder.scan("EMP").scan("DEPT")
        .functionScan(new MockSqlOperatorTable.DedupFunction(),
            Lists.newArrayList(builder.cursor(0),
                builder.cursor(1))).build();
    final String expected = "LogicalTableFunctionScan(invocation="
        + "[DEDUP(CURSOR($0), CURSOR($1))], "
        + "rowType=[RecordType(VARCHAR(1024) NAME)])\n"
        + "  LogicalTableScan(table=[[scott, EMP]])\n"
        + "  LogicalTableScan(table=[[scott, DEPT]])\n";
{code}

Any comment will be appreciated.



was (Author: chunwei lei):
Hi [~julianhyde] [~anmu]
I opened a pull request: https://github.com/apache/calcite/pull/1102.

Though I think the signature is convenient, I am not sure whether it is proper which is as follows:

{code:java}
RelBuilder functionScan(
    SqlOperator operator,
    Iterable<? extends RexNode> operands);

RexNode cursor(int ordinal);
{code}

Any comment will be appreciated.


> Support TableFunctionScan in RelBuilder
> ---------------------------------------
>
>                 Key: CALCITE-1515
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1515
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.10.0
>            Reporter: Anton Mushin
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Calcite has a TableFunctionScan, which is a RelNode, takes a function, 0 or more RelNode inputs, and 0 or more other arguments.
> RelBuilder does not support TableFunctionScan yet. 
> add In RelBuilder TableFunctionScanFactory which will create LogicalTableFunctionScan like as for LogicalTableScan and factory for others RelNodes [ [example|https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/tools/RelBuilder.java#L125] ]
> also adding a functionScan method, analogous to the scan method but for table functions.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)