2016-05-17 61 views
0

我與定義的模式有兩個關係。我希望只找到關係A中不存在的記錄(請參閱this post上的左中間可視化)。如何在Pig Latin中使用WHERE子句寫入左外部連接?

我已經嘗試了下面的兩個變體,但都沒有成功,因爲它們都返回下面的錯誤。我如何在Pig中執行這種操作? 「

」錯誤1200不匹配的輸入「在哪裏期待SEMI-COLON。」

join_result = JOIN relationA by (project_id, sequence_id) LEFT OUTER, relationB by (project_id, sequence_id) WHERE relationB (project_id, sequence_id)is null; 

join_result = JOIN relationA by (project_id, sequence_id) LEFT OUTER, relationB by (project_id, sequence_id) WHERE (relationB.project_id is null) AND (relationB.sequence_id is null); 

回答

1

沒有「WHERE」在PIG.You JOIN一條必須使用過濾器消除基於一個條件的記錄。

join_result = JOIN relationA by (project_id, sequence_id) LEFT OUTER, relationB by (project_id, sequence_id); 
final_result = FILTER join_result BY (relationB.project_id is null AND relationB.sequence_id is null);