Won't SIZE() count the tuples in a bag, and return 0 if it is empty? On Feb 13, 2012, at 1:02 PM, Dmitriy Ryaboy <[email protected]> wrote:
> Flo, how do you want to test for containment -- based on tuple fields? > That doesn't exist afaik (contributions welcome). It'd be fairly trivial to > write. > > > On Mon, Feb 13, 2012 at 11:15 AM, Prashant Kommireddi > <[email protected]>wrote: > >> IsEmpty is the function you might be looking for >> http://pig.apache.org/docs/r0.9.1/func.html#isempty >> >> Thanks, >> Prashant >> >> On Mon, Feb 13, 2012 at 9:41 AM, Flo Leibert <[email protected] >>> wrote: >> >>> Hi - >>> Is there a good way to see if a bag contains a tuple? Given a record that >>> has a tuple T and a Bag (a bag could contain 0 to n tuples), how do I >>> filter the records where the bag contains the tuple? >>> >>> I could write a custom UDF but Pig probably has a built-in function that >>> takes care of this? Looked at the list of built-in functions but couldn't >>> identify one - afaict, there's not "CONTAINS" function. >>> >>> Any pointers would be appreciated! >>> >>> Thanks, >>> florian >>> >>
