Database Reference
In-Depth Information
pig.auto.local.input.maxbytes , default 100,000,000) and no more than one
reducer is being used.
Running Pig Programs
There are three ways of executing Pig programs, all of which work in both local and
MapReduce mode:
Script
Pig can run a script file that contains Pig commands. For example, pig script.pig
runs the commands in the local file script.pig . Alternatively, for very short scripts, you
can use the -e option to run a script specified as a string on the command line.
Grunt
Grunt is an interactive shell for running Pig commands. Grunt is started when no file is
specified for Pig to run and the -e option is not used. It is also possible to run Pig
scripts from within Grunt using run and exec .
Embedded
You can run Pig programs from Java using the PigServer class, much like you can
use JDBC to run SQL programs from Java. For programmatic access to Grunt, use
PigRunner .
Grunt
Grunt has line-editing facilities like those found in GNU Readline (used in the bash shell
and many other command-line applications). For instance, the Ctrl-E key combination
will move the cursor to the end of the line. Grunt remembers command history, too, [ 96 ]
and you can recall lines in the history buffer using Ctrl-P or Ctrl-N (for previous and
next), or equivalently, the up or down cursor keys.
Another handy feature is Grunt's completion mechanism, which will try to complete Pig
Latin keywords and functions when you press the Tab key. For example, consider the fol-
lowing incomplete line:
grunt> a = foreach b ge
If you press the Tab key at this point, ge will expand to generate , a Pig Latin keyword:
grunt> a = foreach b generate
You can customize the completion tokens by creating a file named autocomplete and pla-
cing it on Pig's classpath (such as in the conf directory in Pig's install directory) or in the
Search WWH ::




Custom Search