Example: SELECT and the Function Mapping Definition - Analytics Database - Teradata Vantage

SQL Data Manipulation Language

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
2024-12-13
dita:mapPath
pon1628111750298.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
esx1472246586715
lifecycle
latest
Product Category
Teradata Vantageā„¢

In a SELECT statement with a function mapping, each correlation_name, USING custom clause parameter, or OUT TABLE name that you specify must correspond to a correlation_name, USING custom clause parameter, or OUT TABLE name in the function mapping definition. For information on how to create a function mapping, see Teradata Vantageā„¢ - SQL Data Definition Language Syntax and Examples, B035-1144.

The function mapping definition coxph for the function coxph on the server coprocessor is as follows:

CREATE FUNCTION MAPPING appl_view_db.coxph
FOR coxph SERVER coprocessor 
MAP JSON ( '{ "function_version": "1.0" }') 
   	USING
     	   InputTable IN TABLE,
         CoefficientTable OUT TABLE,
         LinearPredictorTable OUT TABLE,
         TimeIntervalColumn, EventColumn, Threshold, MaxInterNum,
	   FeatureColumns;

In the following SELECT statement, each correlation_name, USING custom clause parameter, or OUT TABLE name corresponds to a correlation_name, USING custom clause parameter, or OUT TABLE name in the function mapping definition.

SELECT * FROM appl_view_db.coxph (
        ON appl_view_db.input_table AS inputtable PARTITION BY 1
        OUTPUT TABLE CoefficientTable(coefficient_table)
        OUTPUT TABLE LinearPredictorTable(linearpredictor_table)
        USING
          FeatureColumns('c1','c2')
          TimeIntervalColumn('t1')
          EventColumn('e1')
) AS dt;