17.10 - Differences Between Table Operators and Table Functions - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1184-171K
Language
English (United States)

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.