Created
February 2, 2012 06:34
-
-
Save rjurney/1722017 to your computer and use it in GitHub Desktop.
A macro to generate pairs of people linked by email communications, given an email that links them
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Filter emails according to existence of header pairs, from and [to, cc, bcc] | |
project the pairs (may be more than one to/cc/bcc), then emit them, lowercased. */ | |
DEFINE header_pairs(email, col1, col2) RETURNS pairs { | |
filtered = FILTER $email BY ($col1 IS NOT NULL) AND ($col2 IS NOT NULL); | |
flat = FOREACH filtered GENERATE FLATTEN($col1) AS $col1, FLATTEN($col2) AS $col2; | |
$pairs = FOREACH flat GENERATE LOWER($col1), LOWER($col2); | |
} | |
pairs = header_pairs(email) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment