Table Operator UDFs
A table operator is a form of a UDF that can only be specified in the FROM clause of a SELECT request. The database treats table operator UDFs as derived table subqueries.
Name overloading is allowed, but because table operators have no explicit input, the table operator UDFs must have a unique name.
A table operator can be defined to operate in all UDF modes, protected, not protected and secure mode.
The table operator cannot run on a PE.
You define the table operator using the SQLTABLE parameter style. SQLTABLE refers to the ANSI UDF parameter style. The ANSI UDF parameter style table operator is passed an input row in the indicdata format and returns the output row in the same format.
Differences between Table Operators and Table Functions
- The input and output to table functions are row sets, or tables, rather than columns. The default format of a row is that of indicdata.
- For a table function, the row iterator is outside the function, and the iterator calls the function.
For a table operator, the iterator is the responsibility of the coder. The table operator itself is called only once.
- For a table operator, the input and output columns are determined by calling the parser function for the table operator at the time the operator is parsed. The operator has full flexibility to determine the output from input and return this information to the parser.
- A table operator can use custom argument clauses to make it more polymorphic.
Because the table operator itself does the iteration, structure it the way a simple AMP step is structured. The writer is provided with a row read/row write interface.
The parser function is similar to the standard scalar UDF in that it accesses one set of arguments (the input column types, and invocation metadata) and returns the list of output column types. However, like table functions, the output table format can also be determined by user specification at run time.