Skip to content

Instantly share code, notes, and snippets.

@jiminoc
Created August 12, 2011 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiminoc/1142411 to your computer and use it in GitHub Desktop.
Save jiminoc/1142411 to your computer and use it in GitHub Desktop.
import macro and calculate uniques
-- Set the default number of reducers for this script
set default_parallel 15;
set job.name unique_users
-- INCLUDE THE OFFICIAL SCHEMA, beacons will be a relation returned
IMPORT 'schema.pig';
beacons = grvschema('$input');
fb = FOREACH beacons GENERATE userGuid;
distSiteUsers = DISTINCT fb;
grpBeacons = GROUP distSiteUsers all;
s = FOREACH grpBeacons GENERATE COUNT(distSiteUsers) as cnt;
STORE s INTO '/user/pig/$output';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment