Pig System Analysis (6) from physical plan to Mr Plan to the Hadoop Job

Source: Internet
Author: User

From physical plan to Map-reduce plan

Note: Since our focus is on the pig on Spark for the Rdd execution plan, the backend references after the physical execution plan are not significant, and these sections mainly analyze the process and ignore implementation details.

The entry class Mrcompiler,mrcompilier traverses the nodes in the physical execution plan in a topological order, converts them to mroperator, and each mroperator represents a map-reduce job. The entire complete plan is stored in the Mroperplan class. The following special handling is done for the load and store operations:

Store must be a leaf node, otherwise throw an exception

Load creates a new Mroperator and joins the Mroperplan.

Here is the Mroperplan schematic:

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/storage/

From Map-reduce plan to the Hadoop Job

Jobcontrolcompiler compiles map-reduce plan into a Hadoop Job.

The entry method is:

Public Jobcontrol compile (Mroperplan, String grpname) throwsjobcreationexception

The Compile method invokes the Getjob method for each mroperator and generates the Hadoop JOB:

Private Job Getjob (Mroperplan plan, Mapreduceoper MRO, Configuration Config,pigcontext Pigcontext) throws Jobcreationexception.

The Mapper&reducer inheritance structure implemented by Pig is as follows:

which

Xxxwithpartitionindex is used for skewedjoin.

Xxxwithcomparator is used for UDF functions that require sorting.

Xxxcounter to data count, for rank operations

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.