过滤的计数值-apache pig

lvjbypge  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(314)

我有以下声明

Values = FILTER Input_Data BY Fields > 0

如何计算已筛选和未筛选的记录数?

kxkpmulp

kxkpmulp1#

-- split into 2 datasets
SPLIT Input_data INTO A IF Field > 0, B if Field <= 0;

-- count > 0 records
A_grp = GROUP A ALL;
A_count = FOREACH A_grp GENERATE COUNT(A);

-- count <= 0 records
B_grp = GROUP B ALL;
B_count = FOREACH B_grp GENERATE COUNT(B);

希望这会有帮助!!

相关问题