Apache Pig Execution Modes
You can run Apache Pig in two modes, namely,Local ModeandHDFS mode.
Local Mode
In this mode, all the files are installed and run from your local host and local file system. There is no need of Hadoop or HDFS. This mode is generally used for testing purpose.
MapReduce Mode
MapReduce mode is where we load or process the data that exists in the Hadoop File System (HDFS) using Apache Pig. In this mode, whenever we execute the Pig Latin statements to process the data, a MapReduce job is invoked in the back-end to perform a particular operation on the data that exists in the HDFS.
Apache Pig Execution Mechanisms
Apache Pig scripts can be executed in three ways, namely, interactive mode, batch mode, and embedded mode.
Interactive Mode(Grunt shell) − You can run Apache Pig in interactive mode using the Grunt shell. In this shell, you can enter the Pig Latin statements and get the output (using Dump operator).
Batch Mode(Script) − You can run Apache Pig in Batch mode by writing the Pig Latin script in a single file with.pigextension.
Embedded Mode(UDF) − Apache Pig provides the provision of defining our own functions (UserDefinedFunctions) in programming languages such as Java, and using them in our script.