我有以下数据:
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 ;
=============================================== =========
我的Pig拉丁文字是:
<connectionStrings>
<add name="TestContext" connectionString="Data Source=REALEXISTINGSERVER;Initial Catalog=TestDb; Integrated Security=true" providername="System.Data.SqlClient"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
错误消息:
java.lang.ClassCastException:java.lang.Integer无法强制转换为java.lang.Long
任何帮助,请
答案 0 :(得分:0)
您遇到的问题是您正在将int数据类型与长数据类型混合使用。
您需要手动将int转换为long。
答案 1 :(得分:0)
问题是COUNT返回long但你将它转换为int 您的代码应如下所示:
BB= foreach BA generate group as EDU, COUNT (Data_filter1) as cn;
或
BB= foreach BA generate group as EDU, COUNT (Data_filter1) as cn:long;