Chapter 6. Developing and Testing Pig Latin Scripts

The last few chapters focused on Pig Latin the language. Now we will turn to the practical matters of developing and testing your scripts. This chapter covers helpful debugging tools such as describe and explain. It also covers ways to test your scripts. Information on how to make your scripts perform better will be provided in the next chapter.

Development Tools

Pig provides several tools and diagnostic operators to help you develop your applications. In this section we will explore these and also look at some tools others have written to make it easier to develop Pig with standard editors and integrated development environments (IDEs).

Syntax Highlighting and Checking

Syntax highlighting often helps users write code correctly, at least syntactically, the first time around. Syntax highlighting packages exist for several popular editors. The packages listed in Table 6-1 were created and added at various times, so how their highlighting conforms with current Pig Latin syntax varies.

Table 6-1. Pig Latin syntax highlighting packages
ToolURL
Eclipsehttps://github.com/eyala/pig-eclipse
Emacshttp://github.com/cloudera/piglatin-mode, http://sf.net/projects/pig-mode
TextMatehttp://www.github.com/kevinweil/pig.tmbundle
Vimhttp://www.vim.org/scripts/script.php?script_id=2186

In addition to these syntax highlighting packages, Pig will also let you check the syntax of your script without running it. If you add -c or -check to the command line, Pig will ...

Get Programming Pig, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.