Tarun, instead AND condition why can't you put OR condition.
A_CLEAN = FILTER B by ($0 is not null) OR ($1 is not null) OR ($2 is not null);
This will remove all the null rows and retain if any columns is not empty.
Can you try and let me know if this works for your all conditions?
UPDATE:
我不知道爲什麼的IsEmpty()不爲你工作,它爲我工作。 IsEmpty只能與袋子一起使用,所以我將所有字段轉換爲袋子並測試空虛。請參閱下面的工作代碼。
input.txt
7|Ron|[email protected]
8|Rina
9|Don|[email protected]
9|Don|[email protected]
10|Maya|[email protected]
11|marry|[email protected]
PigSCript:
A = LOAD 'input.txt' USING PigStorage('|');
B = DISTINCT A;
A_CLEAN = FILTER B BY NOT IsEmpty(TOBAG($0..));
DUMP A_CLEAN;
Output:
(8,Rina )
(7,Ron,[email protected])
(9,Don,[email protected])
(10,Maya,[email protected])
(11,marry,[email protected])
爲了您的另外一個問題,它是一個簡單的數學計算
In case of AND,
8|Rina
will be treated as
($0 is not null) AND ($1 is not null) AND ($2 is not null)
(true) AND (true) AND (false)
(false) -->so this record will be skipped by Filter command
In case of OR,
8|Rina
will be treated as
($0 is not null) OR ($1 is not null) OR ($2 is not null)
(true) OR (true) OR (false)
(true) -->so this record will be included into the relation by Filter command
In case of empty record,
<empty record>
will be treated as
($0 is not null) OR ($1 is not null) OR ($2 is not null)
(false) OR (false) OR (false)
(false) -->so this record will be skipped by Filter command
是......第一個人工作......不是IsEmpty沒有工作。不理解邏輯在這裏...作爲和應該工作,因爲我們正在尋找所有三列應該是空的...謝謝 – Tarun 2014-10-20 21:25:02
更新我的答案,請檢查它。 – 2014-10-21 09:34:24