Breaking News
Loading...

Twitter Example



/*  This program will find out the no of user's that a particular userID is following  */


Inputs:
[User_ID]    [Follower_ID]
12                 13
12                 14
12                 15
16                 17

for example in the above table :
Users 13, 14 and 15 are followers of user 12.
User 17 is a follower of user 16


Code:
A = LOAD '/home/cloudera/pig/twitter.log' AS (userId, followId);

B = GROUP A BY userId;

C = FOREACH B GENERATE group, COUNT(A);

STORE C INTO '/home/cloudera/pig/twitterOut';
- See more at: http://labstrikes.blogspot.in/2012/08/adsense-middle-blog-post.html#sthash.gQgSkqx8.dpuf
 
Toggle Footer