Running Pig Scripts in Zeppelin
This section contains a sample of an Apache Pig script that you can run in your Apache Zeppelin notebook.
About this task
Procedure
-
Using the shell interpreter, copy the password file to the MapR File System:
To use POSIX shell commands like
cp
, you must have a MapR File System mount point in your container. The example below assumes your mount point is/mapr
and your cluster name ismy.cluster.com
:%sh cp /etc/passwd /mapr/my.cluster.com/user/mapruser1
%sh hadoop fs -put /etc/passwd /user/mapruser1/
-
Load the password file in Pig and output the first field in each line in the
file:
%pig A = load 'passwd' using PigStorage(':'); B = foreach A generate $0 as id; dump B;
What to do next
There are other examples of using Pig in the Zeppelin tutorial, including running Pig queries.