a = load '/user/home/samp.txt' using PigStorage(',');
dump a;
(2008-Jan-12,12.1,13.1,36.0)
(2008-Jan-13,13.1,14.1,45.00)
(2008-Jan-15,14.2,15.2,47.00)
(2008-Jan-16,16.1,17.1,47.5)
(2008-Jan-12,8.5,17,50,12.0)
(2008-Jan-12,n#/a,n#/a,n#/a)
(2008-Jan-19,n#/a,n#/a,n#/a)
(2008-Jan-12,n#/a,n#/a,27)
(2008-Jan-12,n#/a,13.00,n#/a)
b = filter a by ($1!='n#/a' OR $2!='n#/a' OR $3!='n#/a');
dump b;
(2008-Jan-12,12.1,13.1,36.0)
(2008-Jan-13,13.1,14.1,45.00)
(2008-Jan-15,14.2,15.2,47.00)
(2008-Jan-16,16.1,17.1,47.5)
(2008-Jan-12,8.5,17,50,12.0)
(2008-Jan-12,n#/a,n#/a,27)
(2008-Jan-12,n#/a,13.00,n#/a)
为什么我还是要 "n#/a"
在b中
1条答案
按热度按时间bnl4lu3b1#
结果与预期一致,因为您正在使用!=和或。你和我吵架了
"n#/a"
因为至少有一个条件对(2008-Jan-12,n#/a,n#/a,27)
以及(2008-Jan-12,n#/a,13.00,n#/a)
如果要筛选没有"n#/a"
使用AND
.如果要使用或,则组合逻辑或结果,然后取反
或
输出