Search This Blog

Saturday, 30 August 2025

pigdemo-1

 1. first create data file emp111.txt in ur LFS

2. MOVE to HDFS

3. OPen vi editor type Pig Script


4. vi pig1.pig


bag1= load 'emp.txt' using PigStorage(',')as  (eno:int,ename:chararray,sal:int);

bag2= filter bag1 by sal > 34000;

store bag2 into 'pigoutput11' using PigStorage(',');




5. execute script

 pig pig1.pig


-------------------------------------------------

avg salary group by clause

-----------------------------------------


bag1= load 'emp11.txt' using PigStorage(',')as

       (eno:int,ename:chararray,sal:int,dname:chararray);

bag2= group bag1 by dname;

bag3= foreach bag2 generate bag1.dname, AVG(bag1.sal);

store bag3 into 'avgop2' using PigStorage(',');


No comments:

Post a Comment

Hadoop Analytics

pigdemo-1

 1. first create data file emp111.txt in ur LFS 2. MOVE to HDFS 3. OPen vi editor type Pig Script 4. vi pig1.pig bag1= load 'emp.txt...