pig没有in子句吗

gr8qqesn  于 2021-06-02  发布在  Hadoop
关注(0)|答案(2)|浏览(247)

我试着

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

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

如何不在子句或其他一些技术中使用pig来清除一个表中的额外记录

cyvaqqii

cyvaqqii1#

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

qoefvg9y2#

除了@rijulsahu的答案,你还可以使用 MATCHES -对正则表达式使用java格式的正则表达式匹配。 BY NOT(ID MATCHES [123])

相关问题