Hi,
Trying to make my script execute happily, it wont stop throwing errors.
It works if I don¹t group my data. But once I group,
It starts with;
ERROR 1000: Error during parsing. Invalid alias: id  in {group:
long,edu_affl: {id
I got rid of it,  then it complains about Invalid alias: org_type,
It keeps going and at the end it complains about mismatch in comparison, as
the left side is a bag and right side is chararray. How ?

Not sure, where I am going wrong, need help;


research =      LOAD 'count'
                USING PigStorage('\t')
                as (id: long, org_type: chararray, dept_type: int,
                cnt: int, cnt_distinct: int);

final_grp =     GROUP research BY id;

Final_table =   FOREACH final_grp
                GENERATE id,
                (org_type == 'S' AND dept_type == 1?cnt:0) AS sale,
                (org_type == 'S' AND dept_type == 2?cnt:0) AS saleEx,
                (org_type == 'C' AND dept_type == 2?cnt:0) AS acc_grp,
                (org_type == 'C' AND dept_type == 4?cnt:0) AS
acc_grp_manual,
                (org_type == 'S' AND dept_type == 1?cnt_distinct:0) AS
sale_distinct,
                (org_type == 'S' AND dept_type == 2?cnt_distinct:0) AS
saleEx_distinct,
                (org_type == 'C' AND dept_type == 2?cnt_distinct:0) AS
acc_grp_distinct,
                (org_type == 'C' AND dept_type == 4?cnt_distinct:0) AS
accM_grp_distinct;

STORE final_table INTO 'final_count' USING PigStorage();

Regards
Syed

Reply via email to