这篇文章主要介绍了hive中流量过程表的示例分析,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
时间 平台 cate1 cate2 cate3 cate4 cate5 lastcateId area1 area2 area3 lastareaId pagetype chlName source1 source2
指标:
`pv` int(11) DEFAULT NULL COMMENT 'pv',
`uv` int(11) DEFAULT NULL COMMENT 'uv',
`newuv` int(11) DEFAULT NULL COMMENT '新访客数',
`visit` int(11) DEFAULT NULL COMMENT '访问数',
`newvisit` int(11) DEFAULT NULL COMMENT '新访问数',
`avgpage` float DEFAULT NULL COMMENT '平均浏览页码',
`avgtime` float DEFAULT NULL COMMENT '平均停留时间',
`jumpin` int(11) DEFAULT NULL COMMENT '跳入数',
`jumpout` int(11) DEFAULT NULL COMMENT '跳出数',
`outrate` float DEFAULT NULL COMMENT '跳出率'
create EXTERNAL table IF NOT EXISTS ext_pctrack_is (
cate1 string COMMENT '4',
cate2 string COMMENT '29',
cate3 string COMMENT '14052',
cate4 string COMMENT '14052',
cate5 string COMMENT '14052',
lastcateId string COMMENT '14052',
area1 string COMMENT '102',
area2 string COMMENT '-',
area3 string COMMENT '-',
lastareaId string COMMENT '14052',
pagetype string COMMENT '14052',
chlName string COMMENT '14052',
source string COMMENT '14052',
pv bigint,
uv bigint,
newuv bigint,
visit bigint,
newvisit bigint,
avgpage DOUBLE,
avgtime DOUBLE,
jumpin bigint,
jumpout bigint,
outrate DOUBLE
)
PARTITIONED BY (statDate STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
COLLECTION ITEMS TERMINATED BY '\002'
MAP KEYS TERMINATED BY '\003'
LINES TERMINATED BY '\n'
STORED AS TEXTFILE
LOCATION '/dsap/middata/shx/IntegrativeStatisticsPC'
;
ALTER TABLE ext_pctrack_is ADD PARTITION (statDate='20140922') LOCATION '/dsap/middata/shx/IntegrativeStatisticsPC/20140922';
set hive.cli.print.header=true;
select * from ext_pctrack_is where statdate='20140922' limit 10;
ALTER TABLE ext_pctrack_is ADD PARTITION (statDate='20141010') LOCATION '/shx/IntegrativeStatisticsPC/20141010';
--查询
select * from ext_pctrack_is
where
statdate='20141022' and
cate1='A' and
cate2='A' and
cate3='A' and
cate4='A' and
cate5='A' and
area1='北京' and
area2='A' and
area3='A' and
pagetype ='A' and
chlname = 'A' and
source1='A' and
source2='A';
--查询二级来源
hadoop fs -cat /shx/IntegrativeStatisticsPC/20141021/par* |awk -F "\t" '{if($24!=""&&$13="广告系列"&&$14!="其他"&&$14!="A") print $0 ; }' |more
hadoop fs -cat /dsap/middata/shx/IntegrativeStatisticsPC/20141021/par* |awk -F "\t" '{print $13"\t" $14}' |more
感谢你能够认真阅读完这篇文章,希望小编分享的“hive中流量过程表的示例分析”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。