Pig has no if: cannot determine a condition after deciding an execution step

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.