【发布时间】:2016-08-31 08:28:37
【问题描述】:
我正在尝试处理示例推文并根据过滤条件存储推文。
例如,
推文示例:-
{"created_time": "18:47:31 ", "text": "RT @Joey7Barton: ..give a word about whether the americans wins a Ryder cup. I mean surely he has slightly more important matters. #fami ...", "user_id": 450990391, "id": 252479809098223616, "created_date": "Sun Sep 30 2012"}
twitter = LOAD 'Tweet.json' USING JsonLoader('created_time:chararray, text:chararray, user_id:chararray, id:chararray, created_date:chararray');
grouped = GROUP twitter BY (text,id);
filtered =FOREACH grouped { row = FILTER $1 BY (text MATCHES '.*word.*'); GENERATE FLATTEN(row);}
它得到与单词匹配的完整推文。
但我需要得到如下输出:
(word)(all tweets of contained that word)
我怎样才能做到这一点?
任何帮助。
莫汉.V
【问题讨论】:
标签: json hadoop apache-pig hadoop-streaming