The pig is the tool that handles the flow, so the dataset is a stream object, and the processing steps are the same.
There are conditions in pig for how flow objects are processed by
1) Filter
x= FILTER A by (f1 = = 8);
2) Case and then ELSE END
Case expression [when value then value]+ [ELSE value]? END
3) bincond[?:]
Condition? Value_if_true:value_if_false
4) SPLITAliasinto alias if expression, alias if expression [, alias if expression ...] [, alias OTHERWISE];
SPLIT A into X if f1<7, Y if f2==5, Z if (f3<6 OR f3>6);
And the composition of the judgment expression is mainly:
= =,!=,>, <,>=,<=,matches,isempty () empty, is not null
However, these conditional processing must target a stream object, col or bag, or the entire object. Cannot handle execution alone, i.e. cannot write
If a is not null then dump A;
This is wrong, dump and store two kinds of operations, can not be placed in other operation statements. That is, there is no single operation such as if.
Store empty object times error with UDF:
The original pig 1.4 version encountered null before the execution, the subsequent version will directly filter out the null record, that is, encountered Null will be returned directly, UDF does not execute the record, see:
http://blog.csdn.net/wisgood/article/details/41851737
Pig has no if: cannot determine a condition after deciding an execution step