Calling a table function
A table function can be used anywhere where SQL allows a table.
The table function returns a table that can contain a number of rows less than, equal to, or
greater than the number of input rows. AEs require that the WITH FINAL clause is used with a table
function. Following is the syntax for calling a table
function:
TABLE WITH FINAL(function_name(arg1, arg2, …))
The following are two examples of calling a table
function:
SELECT * FROM TABLE WITH FINAL(applyOperationV1Tf('+', 1, 2,
3)); RESULT
--------
6
SELECT f1, f2, f3, f4, result
FROM edutestdata,
TABLE WITH FINAL(applyOperationV1Tf('+', f1, f2, f3, f4))
WHERE color = 'red';
RESULT
F1 | F2 | F3 | F4 | RESULT
------+------+-----+-------+--------
1 | 2 | 3 | 4.000 | 10
100 | 300 | 0.5 | 0.500 | 401
-100 | 300 | 0.5 | 0.500 | 201
100 | -300 | 0.5 | 0.500 | -199