Function Mapping and the ON Clause - Teradata Database - Teradata Vantage NewSQL Engine

SQL Data Manipulation Language

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-03
dita:mapPath
fbo1512081269404.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata Vantage™

For information on how to create a function mapping, see "CREATE FUNCTION MAPPING" in Teradata Vantage™ SQL Data Definition Language Syntax and Examples, B035-1144.

The correlation_name must correspond to a name IN TABLE parameter in the function mapping definition. The correlation_name can be any name if the function mapping definition specifies ANY IN TABLE.

The statement below defines the function mapping Attribution.

CREATE FUNCTION MAPPING appl_view_db.Attribution
   FOR attribution SERVER coprocessor 
   MAP JSON ( '{ "function_version": "1.0" }') 
   USING
      ANY IN TABLE,
      conversion IN TABLE,
      excluding IN TABLE,
      optional IN TABLE,
      model1 IN TABLE,
      model2 IN TABLE,
      EventColumn, TimestampColumn, WindowSize;

The SELECT statement below executes the function mapping Attribution.

SELECT * FROM appl_view_db.Attribution ( 
         ON appl_view_db.input_table PARTITION BY 1
         ON appl_view_db.model1 AS model1 DIMENSION
         USING
            TimestampColumn('tscol')
            EventColumn('eventcol')
            WindowSize('rows:10')
) AS dt;