pig-user  

BinCond related parse exceptions.

Mridul Muralidharan
Thu, 27 Mar 2008 15:34:15 -0700

Hi,

I am trying to execute the attached pig script - and run into parse exceptions. Removing the outer BinCond does not result in parse errors ( cond == 3 ) - but is not the functionality I require : essentially, if all constraints are satisfied by some arbitrary set of tuples in A, then generate $1 else $0.

Thanks in advance for any pointers, suggestions or help.
Regards,
Mridul


A = load './a' USING PigStorage('\t');

B = GROUP A by $0;

C = FOREACH B {
  D1 = FILTER A by  ( $0 eq 'val1' ) ;
  D2 = FILTER A by  ( $1 eq 'val2' ) ;
  D3 = FILTER A by  ( $2 eq 'val3' ) ;
GENERATE ( ( ( COUNT (D1) > 0 ? '1' : '0' ) + ( COUNT (D2) > 0 ? '1' : '0' ) + ( COUNT (D3) > 0 ? '1' : '0' ) ) == '3' ? $1 : $0 ) };

DUMP C;