Understanding Map Routines | CREATE ORDERING | Teradata Vantage - High-Level Description of How MAP Routines Work - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
imq1591724555718.ditamap
dita:ditavalPath
imq1591724555718.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

When you compare two values of a given UDT, the system invokes the MAP routine for each of them, then compares the returned values from the MAP routine invocations. Returned values can be specified to have any predefined data type except BLOB or CLOB, and the result of the UDT data type comparison is the same as the result of comparing the returned predefined type values.

The following notation represents the various types of variables used to specify the values to be compared and the external routines used to compare them:
  • Let x and y represent the respective values of the UDT to be compared.
  • The following table indicates the notation used to represent UDFs and methods:
    IF the MAP routine is this type of external routine … THEN use the following notation to represent it …
    user-defined method M()
    user-defined function F

The following table provides examples of the relationships between different values of the same UDT and the user-defined methods used to operate on them:

IF the following method mappings evaluate to TRUE … THEN the result of x comparison_operator y is …
x.M() = Y.M() x = Y
x.M() < Y.M() x < Y
x.M() <> Y.M() x <> Y
x.M() > Y.M() x > Y
x.M() ≤ Y.M() xY
x.M() ≥ Y.M() xY

The following table provides examples of the relationships between different values of the same UDT and the user-defined functions used to operate on them:

IF the following UDF mappings evaluate to TRUE … THEN the result of x comparison_operator y is …
F(x) = F(y) x = y
F(x) < F(y) x < y
F(x) <> F(y) x <> y
F(x) > F(y) x > y
F(x) ≤ F(y) xy
F(x) ≥ F(y) xy