Example: Function Mapping with Multiple ANY IN TABLE Clauses - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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;