Created
March 27, 2014 09:55
-
-
Save saggineumann/9804083 to your computer and use it in GitHub Desktop.
Set operations on Pig Bags
This file contains hidden or 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
outputSchema "bag:{tuple:()}" | |
def bags_interection bag1, bag2 | |
return nil if bag1.nil? | |
return nil if bag2.nil? | |
bag = bag1.map{ |x| x } & bag2.map{ |x| x } | |
db = DataBag.new | |
bag.each { |x| db.add(x) } | |
db | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment