Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4521

Support User Defined Table-valued Function

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • core
    • None

    Description

      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:

      select * from table(UDTVF(table Shipments))
      

      or

      select * from table(UDTVF(select * from Shipments))

      The input parameters of 'UDTVF' is the output rowtype of the inner subquery, and the output of 'UDTVF' is defined by users, just like: 

      final TableValuedFunction tableValuedFunction =
          (RelDataTypeFactory typeFactory) -> typeFactory.builder()
              .add("in1", SqlTypeName.INTEGER)
              .add("in2", SqlTypeName.VARCHAR)
              .build();
      

       

      And the expected output logic plan like: 

      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]])
      

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              herodu herodu
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: