Skip to content

Instantly share code, notes, and snippets.

@saggineumann
Created March 27, 2014 09:55
Show Gist options
  • Save saggineumann/9804083 to your computer and use it in GitHub Desktop.
Save saggineumann/9804083 to your computer and use it in GitHub Desktop.
Set operations on Pig Bags
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