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
