2017-03-29 56 views
0

所以我有一列,U列和列名稱u_id。在豬的foreach語句後過濾

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

我基本上是想通過在u表中的每一行匹配來過濾一張表。 所以基本上如果是從(表1)從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

回答

1

而是加入兩個表。這樣做只會將來自表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;