0

当我转储它时,count_bool 受到具有以下输出的单个元组的影响:

(0)  
...  
(1)  
(0)  
...  
(0)  

因此,如果有 100 - (0) 和 20 - (1) 我希望输出为:

(1, 20)
(0, 100)

这是我尝试变平和计数的尝试

count_by_xy = foreach count_by_subject generate flatten($0), COUNT($0);  
2013-07-09 00:05:43,590 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1045:  
Could not infer the matching function for org.apache.pig.builtin.COUNT as multiple or none of them fit. Please use an explicit cast.  

我的问题是什么?

4

1 回答 1

0

'colName' 是分配给 1 元组列的名称:

count_group = group count_bool by colName;

“结果”有我正在寻找的东西:

result = foreach count_group generate $0, COUNT(count_bool);

$0指第一列的值。

flatten用于取消嵌套元组,这里不需要。

于 2013-07-09T02:06:03.810 回答