Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
tweets - tweetid,tweet,userid
-----------------------------------------------------------
Solution -
OR
REGISTER /home/cloudera/Module-3/PigAdvanced/piggybank.jar
user = LOAD '/user/cloudera/data/test_raw_data/users.csv' USING
org.apache.pig.piggybank.storage.CSVLoader()
AS(userid:chararray,name:chararray,state:chararray);
1. Write a Pig Latin query that outputs the login of all users in NY state
-----------------------------------------------------------------------------------
------
2. Write a Pig Latin query that returns all the tweets that include the word
'favorite', ordered by tweet id
-----------------------------------------------------------------------------------
--------
3. Write a Pig Latin query that returns the number of tweets for each userid
-----------------------------------------------------------------------------------
------------------
4. Write a Pig Latin query that returns the number of tweets for each userid
ordered from most active to least active users
5. Write a Pig Latin query that returns the name of users that posted at least two
tweets
describe q8;
q8: {tweets::tweetid: chararray,tweets::tweet: chararray,tweets::userid:
chararray,user::userid: chararray,user::name: chararray,user::state: chararray}
q9 = group q8 by tweets::userid;
describe q9;
-----------------------------------------------------------------------------------
---------------------------
6. Write a Pig Latin query that returns the name of users that posted no tweets
-----------------------------------------------------------------------------------
------------------------
7. Write a Pig Latin query that returns the number of tweets for each user name
(not user id ).
dump q10;
-----------------------------------------------------------------------------------
----------------------------
8. Write a Pig Latin query that returns the number of tweets for each user name
(not userid), ordered from most active to least active users