Synopses & Reviews
This guide is an ideal learning tool and reference for Apache Pig, the programming language that helps you describe and run large data projects on Hadoop. With Pig, you can analyze data without having to create a full-fledged application—making it easy for you to experiment with new data sets.
Programming Pig shows newcomers how to get started, and teaches intermediate users the benefits of using Pig Latin, the data flow language for building and maintaining pipelines for processing data. Advanced users learn how to build complex data processing pipelines with Pig's macros and modularity features, and discover how to build systems for complex data processing needs by embedding Pig Latin into scripting languages.
- Learn the advantages and disadvantages of using Pig instead of MapReduce
- Understand how Pig fits in with other Hadoop components, such as HDFS, Hive, MapReduce, and HBase
- Follow examples that explain built-in Pig Latin functions, and data operators such as join and group
- Use grunt, the shell that Pig provides for exploring and working with HDFS
- Get performance tuning tips for running Pig Latin scripts on Hadoop clusters in less time
- Extend Pig with powerful user defined functions written in Java or Python
This guide is an ideal learning tool and reference for Apache Pig, the open source engine for executing parallel data flows on Hadoop. With Pig, you can batch-process data without having to create a full-fledged application—making it easy for you to experiment with new datasets.
Programming Pig introduces new users to Pig, and provides experienced users with comprehensive coverage on key features such as the Pig Latin scripting language, the Grunt shell, and User Defined Functions (UDFs) for extending Pig. If you need to analyze terabytes of data, this book shows you how to do it efficiently with Pig.
- Delve into Pigs data model, including scalar and complex data types
- Write Pig Latin scripts to sort, group, join, project, and filter your data
- Use Grunt to work with the Hadoop Distributed File System (HDFS)
- Build complex data processing pipelines with Pigs macros and modularity features
- Embed Pig Latin in Python for iterative processing and other advanced tasks
- Create your own load and store functions to handle data formats and storage mechanisms
- Get performance tips for running scripts on Hadoop clusters in less time
About the Author
Alan is an original member of the engineering team that took Pig from a Yahoo! Labs research project to a successful Apache open source project. In this role he oversaw the implementation of the language, including programming interfaces and the overall design. He has presented Pig at numerous conferences and user groups, universities, and companies. Alan is a member of the Apache Software Foundation and a co-founder of Hortonworks. He has a BS in Mathematics from Oregon State University and a MA in Theology from Fuller Theological Seminary.
Table of Contents
Preface; Data Addiction; Who Should Read This Book; Conventions Used in This Book; Code Examples in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; Chapter 1: Introduction; 1.1 What Is Pig?; 1.2 Pig's History; Chapter 2: Installing and Running Pig; 2.1 Downloading and Installing Pig; 2.2 Running Pig; Chapter 3: Grunt; 3.1 Entering Pig Latin Scripts in Grunt; 3.2 HDFS Commands in Grunt; 3.3 Controlling Pig from Grunt; Chapter 4: Pig's Data Model; 4.1 Types; 4.2 Schemas; Chapter 5: Introduction to Pig Latin; 5.1 Preliminary Matters; 5.2 Input and Output; 5.3 Relational Operations; 5.4 User Defined Functions; Chapter 6: Advanced Pig Latin; 6.1 Advanced Relational Operations; 6.2 Integrating Pig with Legacy Code and MapReduce; 6.3 Nonlinear Data Flows; 6.4 Controlling Execution; 6.5 Pig Latin Preprocessor; Chapter 7: Developing and Testing Pig Latin Scripts; 7.1 Development Tools; 7.2 Testing Your Scripts with PigUnit; Chapter 8: Making Pig Fly; 8.1 Writing Your Scripts to Perform Well; 8.2 Writing Your UDF to Perform; 8.3 Tune Pig and Hadoop for Your Job; 8.4 Using Compression in Intermediate Results; 8.5 Data Layout Optimization; 8.6 Bad Record Handling; Chapter 9: Embedding Pig Latin in Python; 9.1 Compile; 9.2 Bind; 9.3 Run; 9.4 Utility Methods; Chapter 10: Writing Evaluation and Filter Functions; 10.1 Writing an Evaluation Function in Java; 10.2 Algebraic Interface; 10.3 Accumulator Interface; 10.4 Python UDFs; 10.5 Writing Filter Functions; Chapter 11: Writing Load and Store Functions; 11.1 Load Functions; 11.2 Store Functions; Chapter 12: Pig and Other Members of the Hadoop Community; 12.1 Pig and Hive; 12.2 Cascading; 12.3 NoSQL Databases; 12.4 Metadata in Hadoop; Built-in User Defined Functions and Piggybank; Built-in UDFs; Piggybank; Overview of Hadoop; MapReduce; Hadoop Distributed File System; Colophon;