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

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

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.