I haven't seen any objections.
I propose adding support for CURSOR(query) in table and scalar functions, but
not for just any function; only for those defined by the user via SqlFunction
or SqlTableFunction.
This would allow executing queries like this:
SELECT median(CURSOR(SELECT price FROM store WHERE type = p.type)) FROM product
p;
SELECT * FROM TABLE(add_to_price(CURSOR(SELECT priceFROM store), 10));
I suggest passing the following as input to the function:
interface CursorInput {
RelDataType getRowType(); // Query columns.
Enumerable<CursorRow> rows(); // The data itself.
}
In addition to the cursor, it will also be possible to pass other arguments
along with it.
What do you think?