Table Operators | Java UDFs | Teradata Vantage - 17.10 - Table Operators - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL External Routine Programming

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

The guidelines for implementing Java table operators are similar to the guidelines for implementing C/C++ table operators. For more information, see Table Operators.

From the Java perspective, the input and output streams come preopened and you do not have to close the input or output stream because the end of the function is an implicit close. You can close a stream only once. Also, you do not have to read the entire input stream. If you get End Of Data on the input stream, an exception is thrown.

Calling .first() on a TeradataResultSet() rewinds the cursor before the first row instead of to the first row as specified in the Java documentation for java.sql.ResultSet. Therefore, TeradataResultSet.first() is more like java.sql.ResultSet.beforeFirst().
Teradata provides the following Java application classes to support table operators:
  • ArrayTypeInfo
  • ColumnDefinition
  • InputInfo
  • An extension of ResultSet
  • RuntimeContract
  • StreamFormat
  • UDTBaseInfo
  • AMPInfo
  • NodeInfo

The core class for Java SQLTABLE parameter style is RuntimeContract. You define a class with a constructor and an iterator method that is used during the row processing. The constructor acts as the contract function.

Java table operators run in the protected mode Java server just like regular Java UDFs. This environment is multithreaded so you must write the user code to be thread safe.

The rows provided to the table operator are buffered for input and output to improve performance.