15.00 - Differences Between Table Operators and Table Functions - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

Teradata Database
Programming Reference

Differences Between Table Operators and Table Functions

The main differences between table functions and user‑defined table operators are as follows.

  • 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 just called 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 has to do the iteration, it should be structured 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.