Java Table Operator Metadata Mapping - 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™

Data type metadata, including UDT and CDT metadata, can be passed to a table operator contract function.

Note the difference between the terms mapping and transformed type as follows:
Mapping Type
The External Type code that is used in the contract function to identify the data type of a column.
Transform Type
The predefined data type that a UDT or CDT value is converted to by invoking the transform function.

By default, all of the UDT or CDT data values are passed in their default transform form to the operator. This may correspond to either the SQL transform type of the UDT or another predefined type. The behavior is explicitly determined for each individual UDT or CDT type. For Java table operators, an option is provided to pass some UDTs and CDTs in an untransformed or atomized form.

Each of the UDT or CDT type is also mapped to an External Type code in the table operator contract function. Additional information about each type is passed in the UDT_BaseInfo_t structure for C/C++ table operators or the com.teradata.fnc.runtime.UDTBaseInfo class for Java table operators.

The following table shows the metadata mapping in the contract function from Teradata SQL type to the External Type code for UDTs and CDTs.
SQL UDT or Complex Data Type External Type Code
ARRAY/VARRAY ARRAY_DT
DATASET in the Avro storage format DATASET_AVRO_DT
DATASET in the CSV storage format DATASET_CSV_DT
Geospatial – MBB MBB_DT
Geospatial – MBR MBR_DT
Geospatial – ST_Geometry ST_GEOMETRY_DT
JSON JSON_DT
Period type PERIOD_DT
UDT (Distinct) UDT_DT
UDT (Structured) UDT_DT
XML XML_DT

Passing UDT and CDT Columns To and From a Table Operator

The contract function for a table operator describes the input and output columns to be passed and retrieved. The following sections provide detail on how UDT and CDT columns may be passed to and from a table operator.

Retrieving UDT and CDT Input Metadata

The UDT and CDT metadata can be retrieved in the contract function in two ways:
  • You can call the RuntimeContract.getBaseInfo() method. This method returns an array of UDTBaseInfo objects for the ColumnDefinition objects passed in. This method can only be invoked in the contract function.
  • You can use the InputInfo class getUDTMetaData() method to retrieve the UDT and CDT metadata in both the contract and execute functions. The method returns an array of UDTBaseinfo objects for the input columns.

Setting UDT and CDT Output Metadata

Each output column is described using an instance of the class ColumnDefinition.