16.20 - Example: Function Mapping with Multiple ANY IN TABLE Clauses - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-24
dita:mapPath
wkf1512081455740.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
mdr1472255012272

This function mapping definition includes two ANY IN TABLE clauses.

During function processing, the first two ON clauses that do not have correlation names correspond to the two ANY IN TABLE clauses.

CREATE FUNCTION MAPPING user_Attribution
   FOR attribution MAP JSON ( '{ "function_version": "1.0" }') 
   USING
      ANY IN TABLE,
      ANY IN TABLE,
      conversion IN TABLE,
      excluding IN TABLE,
      optional IN TABLE,
      model1 IN TABLE,
      model2 IN TABLE,
      EventColumn, TimestampColumn, WindowSize;
This SELECT statement includes two ON clauses do not have correlation names: :
  • attribution_sample_table1
  • attribution_sample_table2

These tables correspond to the two ANY IN TABLE clauses of the user_Attribution function mapping.

SELECT * FROM user_ATTRIBUTION(
    ON attribution_sample_table1 PARTITION BY user_id 
                                 ORDER BY time_stamp
    ON attribution_sample_table2 PARTITION BY user_id 
                                 ORDER BY time_stamp
    ON conversion_event_table AS conversion DIMENSION
    ON excluding_event_table AS excluding DIMENSION
    ON optional_event_table AS optional DIMENSION
    ON model1_table AS model1 DIMENSION
    ON model2_table AS model2 DIMENSION
USING
    EVENT_COLUMN_NAME ('event')
    TIMESTAMP_COLUMN_NAME ('time_stamp')
    WINDOW('rows:10&seconds:20')
    ) as dt ORDER BY user_id, time_stamp;