Data type metadata, including UDT and CDT metadata, can be passed to a table operator contract function.
- 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.
|SQL UDT or Complex Data Type||External Type Code|
|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|
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
- 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.