tkalkirill commented on PR #5300:
URL: https://github.com/apache/calcite/pull/5300#issuecomment-6044500582
@mihaibudiu
Thanks for taking a look. I should have explained the goal more clearly.
CURSOR(SELECT ...) lets a table function receive the rows produced by
another query as an argument. For example:
```
SELECT *
FROM TABLE(process_employees(
CURSOR(SELECT empno, sal FROM emp),
100
));
```
Here, process_employees receives the employee rows and a scalar argument. It
reads the input rows, performs its custom processing, and returns a table.
Calcite already accepts this SQL syntax, but execution of these cursor
arguments was missing. This PR implements that execution path.
The core change connects the cursor’s relational input to the function call.
The remaining changes provide the ResultSet adapter for Java table functions,
input metadata, resource cleanup, and tests.
The scope is cursor inputs to table functions. Returning cursors as SQL
values and supporting cursor arguments in scalar functions are outside this PR.
My use case is to support functions that consume query results and generate
XML documents, both as table functions and as scalar functions. To keep the
initial implementation simpler, I started with cursor arguments for table
functions. Support for scalar functions would be a separate follow-up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]