7.00.02 - Cogroup Example - Aster Analytics

Teradata AsterĀ® Analytics Foundation User GuideUpdate 2

Product
Aster Analytics
Release Number
7.00.02
Published
September 2017
Language
English (United States)
Last Update
2018-04-17
dita:mapPath
uce1497542673292.ditamap
dita:ditavalPath
AA-notempfilter_pdf_output.ditaval
dita:id
zuk1466006200888

The example uses a fictional SQL-MapReduce function, attribute_sales, which accepts two partitioned inputs and two arguments.

The inputs are:
  • weblog, which contains web store logs, the source of purchase information
  • adlog, which contains ad server logs

Both inputs are partitioned on the user browser cookie.

Cogroup Example Tables

The function arguments are:
  • Clicks, which specifies the percentage of sales to attribute to clicked ads that lead to a purchase
  • Impressions, which specifies the percentage of sales to attribute to web page views that lead to a purchase

Consider the following function call:

SELECT adname, attr_revenue FROM attribute_sales (
  ON (SELECT cookie, cart_amt, adname, action
      FROM weblog
      WHERE page = 'thankyou') AS W PARTITION BY cookie
  ON adlog AS S PARTITION BY cookie
  Clicks(.8)
  Impressions(.2)
);

The following figure shows how SQL-MapReduce runs the preceding function call.

How a SQL-MapReduce Function Performs a Cogroup