you can run a replacement loop if you want: zeroes = foreach foo generate ( x is null ? 0 : x) as x;
or if you are dealing with empties instead of nulls zeroes = foreach foo generate (IsEmpty(x) ? 0 : x) as x; On Tue, Jul 6, 2010 at 2:57 PM, Wilkes, Chris <[email protected]> wrote: > SUM($1,$3) doesn't work? If the column is a non-double then it is > converted to a 0. > > > > > On Jul 6, 2010, at 2:47 PM, Brian Adams wrote: > > So I asked a question earlier, but figured it wasn't very clear and thus >> less likely to get answered, so here goes. >> >> I have 2 sources with seperate ngrams and counts and after doing a full >> out join i get: >> >> Example with numbers: >> dog,10,dog,20 >> cat,5,null/empty,null/empty >> null/empty, null/empty,mouse,10 >> >> If i want to sum up $1 with $3 the first row would give me >> dog,10,dog,20,30 >> >> However, when I cat the results out, the second row looks like >> cat,5,emtpy,emtpy,empty >> >> And Lastly, the 3rd appears like >> empty,empty,mouse,10,emtpy >> >> So if there is not a count in position $1 or $3, then I cannot add them >> together. >> >> How do I replace the emtpy with a 0 so I can perform the summation in >> the last column? >> >> Desired Output: >> dog,10,dog,20,30 >> cat,5,emtpy,0,5 >> empty,0,mouse,10,10 >> >> Thanks guys. >> >> >> >> >> >
