Ready to master the Apache Pig but not sure how to get started?
How can I master Apache Pig?
The process for mastering a programming language is that same as learning any other skills. Practice, Practice, Practice.
The practice needs to be focused and using different scenarios to be effective. Performing the same task over will not get you to the mastery level. However using Pig functions you haven’t used before to process real world examples is the kind of practice needed to master Pig Latin.
Imagine a race car driver trying to become an elite racer. He will practice racing on different tracks and even practice specific scenarios he might see in a race. Now let’s apply that logic to a Pig developer, you need to practice using Pig to solve real world problems and using new functions.
In this Apache Pig Eval Function series I have packages together different data sets and a series of quick scenarios for developers to solve using Pig. Each post in this series will focus on a single Pig Eval Function, defining the function and then using that function in a real world example. All the code and data are provided for each of these examples making your journey to becoming a Apache Pig master easier.
Looking for a complete way to master the basics of Pig? Try my Pluralsight course Pig Latin:Getting Started.
Why Eval Functions?
Pig ships with many different built-in functions and learning these functions can save you time. The eval or evaluation functions are a group of functions that you will typically not learn when you first start out with Pig. When we think about evaluations functions the first thing that comes to mind are mathematical functional like addition or subtraction, but Pig Eval Functions contain useful string functions as well. Concatenating a string is one of the most useful Pig Eval string functions, think about trying to merge two fields such as first and last name. The Pig Eval Functions has a CONCAT() function built-in with the standard Pig build.
The code and data can be found at my Example Pig Script Github page.
Deep dive for the Apache Pig Eval Functions:
- Average – Learn how to get the average of a column using the AVG() function.
- Sum – Get the sum of a column using the SUM() function.
- Concatenation – Merge two or more columns together using the CONCAT() function.
- Tokenize – Find out how to breakdown fields using the TOKENIZE() function.
- Min – Using the MIN() function over data in Pig
- Max – Master using the MAX() function in Pig Latin.
- Count – Take the population data from previous tutorials and use the COUNT() function.