Table Operators | Java UDFs | Teradata Vantage - Table Operators - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
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.