Code is'nt executing


5 Answer(s)


Hi Rashmi,

Could you please share the error you are getting.

Thanks


Hi Reshmi,

Select t.retweeted_username, sum(retweets) as total_retweets, count(*) as tweet_count
from
select retweet_stat.user.username as retweeted_userame,
retweet_stat.text, max(retweet_stat.retweet_num) as reweets from

influential_tweets group by retweet_stat.user.username, retweet_stat.text
)
group by t.retweeted_username
order by total_retweets DESC, tweet_count ASC
limit 10;

This ')' is unnecessary and generating error.

Hope this helps.

Thanks.


I am still getting this error, no matter how many  times I try.

    > select t.retweeted_username, sum(retweets) as total_retweets, count(*) as tweet_count from
    > select retweet_stat.user.username as retweeted_username,
    > retweet_stat.text, max(retweet_stat.retweet_num) as retweets from
    > influential_tweets group by retweet_stat.user.username, retweet_stat.text
    > Group by t.retweeted_username,
    > Order by total_retweets DESC, tweet_count ASC,
    > limit 10;
FAILED: ParseException line 2:0 cannot recognize input near 'select' 'retweet_stat' '.' in join source
 


Hi Reshami,

Try this code:

 select t.retweeted_username, sum(retweets) as total_retweets, count(*) as tweet_count from
    > (select retweet_stat.user.username as retweeted_username,
    > retweet_stat.text, max(retweet_stat.retweet_num) as retweets from
    > influential_tweets group by retweet_stat.user.username, retweet_stat.text) t
    > Group by t.retweeted_username,
    > Order by total_retweets DESC, tweet_count ASC,
    > limit 10;

Hope this helps.

Thanks,


Hi Abhijit,

I've been trying to get the code right for a while now. I've pasted the query and the error below. Please help me out.

TRIAL 1: hive> 
    > Select t.retweeted_username, sum(retweets) as total_retweets, count(*) as tweet_count from
    > (select retweet_stat.user.username as retweeted_username,
    > retweet_stat.text, max(retweet_stat.retweet_num) as retweets from
    > influential_tweets group by retweet_stat.user.username, retweet_stat.text) t
    >      Group by t.retweeted_username,
    >      Order by t.total_retweets  DESC, t.tweet_count ASC,
    >      limit 10;
FAILED: ParseException line 6:5 cannot recognize input near 'Order' 'by' 't' in expression specification
 

TRIAL 2: hive> Select t.retweeted_username, sum(retweets) as total_retweets, count(*) as tweet_count from
    > (select retweet_stat.user.username as retweeted_username,
    > retweet_stat.text, max(retweet_stat.retweet_num) as retweets from
    > influential_tweets group by retweet_stat.user.username, retweet_stat.text) t
    >      Group by t.retweeted_username,
    >      Order by sum(retweets) DESC, tweet_count ASC,
    >      limit 10;
FAILED: ParseException line 6:5 cannot recognize input near 'Order' 'by' 'sum' in expression specification
 

Regards

Rashmi