PIG 是否有 NOT IN 子句

Does PIG have NOT IN clause

我正在尝试

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

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

如何使用 pig

使用 NOT IN 子句或其他一些技术来消除一个 table 中存在的额外记录

是的,您可以在 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);

除了@Rijulsahu 的回答,您还可以使用 MATCHES - Regular expression matching that Uses the Java format 作为正则表达式。

BY NOT(ID MATCHES [123])