Created 03-12-2016 08:35 AM
Created 03-12-2016 02:52 PM
@Mahesh Deshmukh I'm not sure what your need is, but null values should be filtered first. The general rule of thumb in Pig is to "filter early and often" to minimize the amount of data that gets shuffled and sorted, so before the foreach:
For example:
a = "some Pig relation" b = filter a by $1 is not null; //filter out tuples where the $1 field is null c = foreach b generate ... //no need to worry about $1 being null
The term "empty" refers to bags typically, and in particular you can use the isEmpty function to check if a bag is empty. You normally do this after a GROUP command:
a = "some Pig relation" b = group a by $3; c = filter b by not IsEmpty(group);
What are you trying to accomplish?
Created 03-12-2016 08:48 AM
Please see the official docs. Both null and IsEmpty is addressed https://pig.apache.org/docs/r0.15.0/basic.html#nulls
Created 03-12-2016 02:52 PM
@Mahesh Deshmukh I'm not sure what your need is, but null values should be filtered first. The general rule of thumb in Pig is to "filter early and often" to minimize the amount of data that gets shuffled and sorted, so before the foreach:
For example:
a = "some Pig relation" b = filter a by $1 is not null; //filter out tuples where the $1 field is null c = foreach b generate ... //no need to worry about $1 being null
The term "empty" refers to bags typically, and in particular you can use the isEmpty function to check if a bag is empty. You normally do this after a GROUP command:
a = "some Pig relation" b = group a by $3; c = filter b by not IsEmpty(group);
What are you trying to accomplish?