Hope you are doing good,

Please check an example of pig in local.

Created a file students in local,

We can find the path using pwd command.

To load local file using pig

We have to start pig (grunt) using command pig -x local

image


image

student = LOAD '/mnt/home/support_test_01/students.txt' USING PigStorage(',')
   as (id:int,name:chararray,city:chararray);


image

dump student;

image

image

===============================================================================

From hdfs 

To load hdfs file using pig

So , same students.txt we are transfering from local to hdfs

hadoop fs -copyFromLocal students.txt

image

hadoop fs -ls

image

Now start the pig using command

pig

image


image

====================

For checking hdfs 

hadoop fs -ls   //will show the files in hdfs

for example

image

Using below path also , we will be able to check hdfs.

hadoop fs -ls  /user/<edureka_id>/

image

Hope this helps.

Please let us know if you have any query.



563053:41453