PIG是否有NOT IN子句

时间:2017-01-31 11:39:53

标签: hadoop mapreduce apache-pig

我正在尝试

select * from A where A.ID NOT IN (select id from B) (in sql)

filtersource= FILTER source BY ID NOT(destination.ID)

如何使用NOT IN子句或其他技术来清除一个表中使用猪的额外记录

2 个答案:

答案 0 :(得分:0)

是的,你可以在PIG中这样做:

filtersource= FILTER source BY NOT ID IN (your condition or joined field);

示例:

HIVE> select * from table where id NOT IN ('1','2','3');

grunt> A = LOAD 'db.table' USING org.apache.hive.hcatalog.pig.HCatLoader() AS (id:int, value:chararray);
grunt> B = FILTER A BY NOT id IN (1,2,3);

答案 1 :(得分:0)

除了@ Rijulsahu的回答之外,您还可以使用here - 正则表达式匹配,使用MATCHES作为正则表达式。

"