Hadoop 我想路径优化用户旅行我的网站在旅行中的特定时间在猪的特定时间
输入数据集:Hadoop 我想路径优化用户旅行我的网站在旅行中的特定时间在猪的特定时间,hadoop,hive,apache-pig,Hadoop,Hive,Apache Pig,输入数据集: (2012-07-21T14:00:00.000Z, joe, hxxp:///www.aaa.com/home) (2012-07-21T14:01:00.000Z, mary, hxxp:///www.aaa.com/watch) (2012-07-21T14:02:00.000Z, joe, hxxp:///www.aaa.com/movie) (2012-07-21T14:01:00.000Z, mary, hxxp:///www.aaa.com/mobile)
(2012-07-21T14:00:00.000Z, joe, hxxp:///www.aaa.com/home)
(2012-07-21T14:01:00.000Z, mary, hxxp:///www.aaa.com/watch)
(2012-07-21T14:02:00.000Z, joe, hxxp:///www.aaa.com/movie)
(2012-07-21T14:01:00.000Z, mary, hxxp:///www.aaa.com/mobile)
预期产出:
(joe (hxxp:///www.aaa.com/home, hxxp:///www.aaa.com/movie))
(mary(hxxp:///www.aaa.com/watch, hxxp:///www.aaa.com/mobile))
我想在ApachePig中做这样的路径分析项目
用户如何访问我的网站,我想路径优化
用户首先看到该网站hxxp:///www.aaa.com/home 2秒后,他搬到hxxp:///www.aaa.com/movie 此页面我想分析用户旅行我的网站旅行的特定时间输入:
猪字:
输出:转储用户导航统计信息:
如何更改url链接hxxp:///www.aaa.com/home into name HOME@SivasaravanaKumar:使用正则表达式或字符串函数提取字符串的最后一部分并更改大小写。@SivasaravanaKumar:如果答案有帮助,您可以接受答案。
2012-07-21T14:00:00.000Z,joe,hxxp:///www.aaa.com/home
2012-07-21T14:01:00.000Z,mary,hxxp:///www.aaa.com/watch
2012-07-21T14:02:00.000Z,joe,hxxp:///www.aaa.com/movie
2012-07-21T14:01:00.000Z,mary,hxxp:///www.aaa.com/mobile
user_navigation_data = LOAD 'user_nav_data.csv' USING PigStorage(',') AS (time:datetime,user:chararray,url:chararray);
nav_data_grp_user = GROUP user_navigation_data BY user;
user_nav_stats = FOREACH nav_data_grp_user {
user_navigation_data_ord = ORDER user_navigation_data BY time;
GENERATE group AS user, BagToString(user_navigation_data_ord.url,'-->') AS urls_accessed;
};
(joe,hxxp:///www.aaa.com/home-->hxxp:///www.aaa.com/movie)
(mary,hxxp:///www.aaa.com/watch-->hxxp:///www.aaa.com/mobile)