Kirill Tkalenko created CALCITE-7664:
----------------------------------------

             Summary: Support CURSOR for table functions
                 Key: CALCITE-7664
                 URL: https://issues.apache.org/jira/browse/CALCITE-7664
             Project: Calcite
          Issue Type: Improvement
            Reporter: Kirill Tkalenko
            Assignee: Kirill Tkalenko


[https://www.mail-archive.com/[email protected]/msg26089.html]



It is proposed to support CURSOR for table functions; I did not encounter any 
objections or comments in the [Support CURSOR for 
UDF|https://www.mail-archive.com/[email protected]/msg26084.html] on dev 
list. Currently, parsing such queries works, but execution does not.

Example query:
{code:java}
SELECT *
FROM TABLE(cursor_and_number(
  CURSOR(SELECT empno AS n FROM emp),
  (SELECT MAX(deptno) FROM dept)
));{code}
Proposed structure for the function argument:
{code:java}
package org.apache.calcite.sql.util;

import org.apache.calcite.linq4j.Enumerable;
import org.apache.calcite.rel.type.RelDataType;

/** Input passed to a table function for a {@code CURSOR} argument. */
public interface CursorInput {
  /** Returns the row type of the cursor query. */
  RelDataType getRowType();

  /** Returns the rows produced by the cursor query. */
  Enumerable<Object[]> rows();
}{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to