Table Operators and Table Functions | VantageCloud Lake - Table Operators and Table Functions - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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.

Table functions and table operators cannot run against fallback data when an AMP is down. After the AMP returns to service, the query can complete as normal.

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 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.