官术网_书友最值得收藏!

Chapter 3. Advanced Pig

Running Java MapReduce jobs on Hadoop provides the most flexibility with the least abstraction. However, abstractions are necessary to infer patterns, accomplish common data manipulation tasks, reduce complexity, and flatten the learning curve. Pig is a platform that provides a framework and high-level abstractions to build MapReduce programs for Hadoop. It has a scripting language called Pig Latin. Pig Latin can be compared to SQL in terms of operator capabilities.

Developed at Yahoo! around the year 2006, Pig was used as a framework to specify ad hoc MapReduce workflows. In the following year, it was moved to Apache Software Foundation. The latest release of Pig is 0.12.1.

Tip

The official release of Pig is currently incompatible with Hadoop 2.2.0. It expects libraries from Hadoop 1.2.1. Running any Pig script fails, with the following exception:

Unexpected System Error Occured: java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected.

Fixing this requires a recompile of the Pig binaries. Run the following command and replace the newly generated pig.jar and pig-withouthadoop.jar files:

ant clean jar-all -Dhadoopversion=23

In this chapter, we will look at the advanced features of Pig by:

  • Looking at how Pig is different when compared to SQL
  • Analyzing how Pig Latin scripts are translated to MapReduce programs
  • Delving into the advanced relational operators that Pig supports; we will delve deep into these relational operators and look at their applications with examples
  • Studying ways to extend Pig beyond its off-the-shelf capabilities using User-defined Functions or UDFs that can implement a variety of interfaces; we will examine some of these interfaces
主站蜘蛛池模板: 云浮市| 鄢陵县| 泊头市| 云林县| 蒲江县| 分宜县| 石台县| 乐东| 望城县| 赤城县| 武功县| 突泉县| 大兴区| 岑溪市| 桦川县| 克拉玛依市| 哈巴河县| 四川省| 文昌市| 沈丘县| 福海县| 沂水县| 丹巴县| 南康市| 鹿邑县| 尉氏县| 南溪县| 偏关县| 西青区| 新营市| 德格县| 三亚市| 自贡市| 南江县| 襄汾县| 尚义县| 南郑县| 乌恰县| 湖北省| 汕尾市| 长沙县|