Thanks Cheolsoo, Not very intuitive but makes sense.
On Wed, Aug 22, 2012 at 2:37 PM, Cheolsoo Park <[email protected]>wrote: > Hi Alex, > > I think that that's expected. The Pig manual says the following > regarding comparison > operators (e.g. ==): > > If either sub-expression is null, the result is null. > > > So "col1 == null" is null. > > Now it also says the following regarding arithmetic operators (e.g. ?): > > If either sub-expression is null, the resulting expression is null. > > > So "col1 == null ? 'null' : 'not-null'" is null as "col1 == null" is null. > > Here is the link: > http://pig.apache.org/docs/r0.10.0/basic.html#nulls > > Thanks, > Cheolsoo > > On Wed, Aug 22, 2012 at 11:28 AM, Alex Rovner <[email protected]> > wrote: > > > I am having trouble with bincond in pig 11. > > > > Sample input: > > 1234 > > 0 > > 1234 > > > > Sample pig script: > > a = LOAD 'input.txt' as (col1:int); > > > > b = FOREACH a GENERATE col1, (col1 == null ? 'null' : 'not-null') as > col2; > > > > dump b; > > > > > > Output: > > (1234,) > > (0,) > > (1234,) > > > > > > Certainly not what you expect to see... I expected to see 'not-null' > string > > in the second column. > > If I change the bincond to look for a particular value then everything > > works as expected: > > > > b = FOREACH a GENERATE col1, (col1 == 1234 ? 'null' : 'not-null') as > col2; > > > > Output: > > (1234,null) > > (0,not-null) > > (1234,null) > > > > > > Any ideas? I did not get a chance to test this with prior versions. > > > > Thanks > > Alex > > >
