2016-11-14 5 views
1

私はいくつかの列の平均値を求め、すべての列の値が計算された平均より大きい行のみを取得するブタスクリプトを書く必要があります。豚で複数の条件を使用する列をフィルタリングする

i2 = GROUP i1 all; 
i3 = FOREACH i2 GENERATE AVG(i1.user_followers_count) AS avg_user_followers_count, AVG(i1.avl_user_follower_following_ratio) AS avg_avl_user_follower_following_ratio, AVG(i1.user_total_liked) AS avg_user_total_liked, AVG(i1.user_total_posts) AS avg_user_total_posts, AVG(i1.user_total_public_lists) AS avg_user_total_public_lists, AVG(i1.avl_user_total_retweets) AS avg_avl_user_total_retweets, AVG(i1.avl_user_total_likes) AS avl_user_total_likes, AVG(i1.avl_user_total_replies) AS avg_avl_user_total_replies, AVG(i1.avl_user_engagements) AS avl_avl_user_engagements, AVG(i1.user_reply_to_reply_count) AS avg_user_reply_to_reply_count; 

top_inf = FILTER i1 BY (i1.user_followers_count > i3.avg_user_followers_count, i1.avl_user_total_retweets > i3. avg_avl_user_total_retweets, i1.avl_user_total_likes > i3.avg_avl_user_total_retweets); 

しかし、これはエラーがスローされます:私のスクリプトがある

ERROR 1200: <file user.pig, line 70, column 103> mismatched input '>' expecting RIGHT_PAREN 

複数の条件で行をフィルタする正しい方法は何ですか?

答えて

3

使用し、条件

top_inf = FILTER i1 BY (i1.user_followers_count > i3.avg_user_followers_count) 
        AND (i1.avl_user_total_retweets > i3.avg_avl_user_total_retweets) 
        AND (i1.avl_user_total_likes > i3.avg_avl_user_total_retweets); 
を分離します
関連する問題