Skip to content

Instantly share code, notes, and snippets.

@rjurney
Created February 7, 2012 01:35
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 rjurney/1756481 to your computer and use it in GitHub Desktop.
Save rjurney/1756481 to your computer and use it in GitHub Desktop.
Pig macro to count records in a relation
/* Get a count of records. */
DEFINE total_count(relation) RETURNS total {
$total = FOREACH (group $relation all) generate $relation as label, COUNT_STAR($relation) as total;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment