在猪的foreach声明后过滤(Filter after a foreach statement in pig)

所以我有一个列的表,U,并且列名为u_id。

filter_out = filter A BY s_id == (FOREACH u GENERATE u_id);

我基本上试图通过匹配u表中的每一行来过滤一个表。 因此,如果来自A(table1)的s_id与第二个表中的u_id匹配,则将其过滤掉

我一直在输入'u' expecting LEFT_PAREN错误的输入不匹配

-------------第二种方法----------------

并且还尝试过将你转换为元组

totuple = FOREACH u GENERATE TOTUPLE (u_id); filter_out = filter A BY s_id in (totuple);

和错误A column needs to be projected from a relation for it to be used as a scalar

So i have table with one column, U and has column name u_id.

filter_out = filter A BY s_id == (FOREACH u GENERATE u_id);

I am basically trying to filter A table by match of every row in u table. So essentially if s_id from A(table1) matches u_id from 2nd tables, filter it out

I keep getting mismatched input 'u' expecting LEFT_PAREN error

-------------2nd approach----------------

And also have tried converting u to a tuple

totuple = FOREACH u GENERATE TOTUPLE (u_id); filter_out = filter A BY s_id in (totuple);

and error A column needs to be projected from a relation for it to be used as a scalar

最满意答案

相反,加入两个表。这样只会将表A中的记录与表U中的记录匹配。最后生成所需的列。

B = JOIN A BY s_id,U BY u_id; C = FOREACH B GENERATE B.$0; -- Select the needed columns from the joined relation. DUMP C;

Instead, JOIN the two tables.Doing so will only match the records from table A with the records from table U.Finally generate the columns needed.

B = JOIN A BY s_id,U BY u_id; C = FOREACH B GENERATE B.$0; -- Select the needed columns from the joined relation. DUMP C;在猪的foreach声明后过滤(Filter after a foreach statement in pig)

所以我有一个列的表,U,并且列名为u_id。

filter_out = filter A BY s_id == (FOREACH u GENERATE u_id);

我基本上试图通过匹配u表中的每一行来过滤一个表。 因此,如果来自A(table1)的s_id与第二个表中的u_id匹配,则将其过滤掉

我一直在输入'u' expecting LEFT_PAREN错误的输入不匹配

-------------第二种方法----------------

并且还尝试过将你转换为元组

totuple = FOREACH u GENERATE TOTUPLE (u_id); filter_out = filter A BY s_id in (totuple);

和错误A column needs to be projected from a relation for it to be used as a scalar

So i have table with one column, U and has column name u_id.

filter_out = filter A BY s_id == (FOREACH u GENERATE u_id);

I am basically trying to filter A table by match of every row in u table. So essentially if s_id from A(table1) matches u_id from 2nd tables, filter it out

I keep getting mismatched input 'u' expecting LEFT_PAREN error

-------------2nd approach----------------

And also have tried converting u to a tuple

totuple = FOREACH u GENERATE TOTUPLE (u_id); filter_out = filter A BY s_id in (totuple);

and error A column needs to be projected from a relation for it to be used as a scalar

最满意答案

相反,加入两个表。这样只会将表A中的记录与表U中的记录匹配。最后生成所需的列。

B = JOIN A BY s_id,U BY u_id; C = FOREACH B GENERATE B.$0; -- Select the needed columns from the joined relation. DUMP C;

Instead, JOIN the two tables.Doing so will only match the records from table A with the records from table U.Finally generate the columns needed.

B = JOIN A BY s_id,U BY u_id; C = FOREACH B GENERATE B.$0; -- Select the needed columns from the joined relation. DUMP C;