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 流量过程表)