Skip to content

Instantly share code, notes, and snippets.

@hito-asa
Created April 18, 2013 06:12
Show Gist options
  • Save hito-asa/5410544 to your computer and use it in GitHub Desktop.
Save hito-asa/5410544 to your computer and use it in GitHub Desktop.
A = LOAD '$INPUT' AS (datetime:chararray, vuid:chararray, uid:chararray, p4,p5, device:chararray, p7,p8,p9, action:chararray, p11);
B = FILTER A BY action == 'requested';
PV1 = GROUP B BY device;
PV2 = FOREACH PV1 GENERATE group AS device:chararray, COUNT(B) AS pv:long;
UU1 = FOREACH B GENERATE vuid, device;
UU2 = DISTINCT UU1;
UU3 = GROUP UU2 BY device;
UU4 = FOREACH UU3 GENERATE group AS device:chararray, COUNT(UU2) AS uu:long;
LUU1 = FOREACH B GENERATE uid, device;
LUU2 = DISTINCT LUU1;
LUU3 = GROUP LUU2 BY device;
LUU4 = FOREACH LUU3 GENERATE group AS device:chararray, COUNT(LUU2) AS luu:long;
PU1 = JOIN PV2 BY device, UU4 BY device, LUU4 BY device;
PU2 = FOREACH PU1 GENERATE PV2::device, pv, uu, luu;
STORE PU2 INTO '$OUTPUT';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment