我有以下数据:

AGE,EDU,SEX,SALARY
67,10th,Male,<=50K
17,10th,Female,<=50K
40,Assoc-voc,Male,>50K
35,Assoc-voc,Male,<=50K
57,Assoc-voc,Male,<=50K
49,Assoc-voc,Male,>50K
42,Bachelors,Male,>50K
30,Bachelors,Male,>50K
23,Bachelors,Female,<=50K

================================================== ======

我的Pig Latin脚本是:
sensitive = LOAD '/mdsba' using PigStorage(',') as (AGE,EDU,SEX,SALARY);
--Filtered the data by the city
Data_filter1 = FILTER sensitive by (SALARY matches '<=50K');
Data_filter2 = FILTER sensitive by (SALARY matches '>50K');
BA= group  Data_filter1 by (EDU,SEX) ;

BB= foreach BA generate group as EDU, COUNT (Data_filter1) as cn:int;

BC= FILTER BB by (cn == 4);

Dump BC ;

错误消息:

java.lang.ClassCastException:无法将java.lang.Integer强制转换为java.lang.Long

任何帮助请

最佳答案

您遇到的问题是将int数据类型与long数据类型混合在一起。

您需要手动将int转换为long。

关于hadoop - Pig Latin语法错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36232087/

10-12 20:16