Commit d94caf39 authored by 魏艺敏's avatar 魏艺敏

update codes

parent acdbec28
...@@ -36,7 +36,7 @@ SELECT `日期`,`设备类型`,`活跃类型`,`渠道` ...@@ -36,7 +36,7 @@ SELECT `日期`,`设备类型`,`活跃类型`,`渠道`
FROM FROM
( (
SELECT t1.partition_date as `日期` SELECT t1.partition_date as `日期`
,t1.device_type as `设备类型` ,t1.device_os_type as `设备类型`
,t1.active_type as `活跃类型` ,t1.active_type as `活跃类型`
,t2.channel as `渠道` ,t2.channel as `渠道`
,count(case when type='美购详情页' then cl_id end ) as `美购详情页浏览pv` ,count(case when type='美购详情页' then cl_id end ) as `美购详情页浏览pv`
...@@ -56,7 +56,7 @@ FROM ...@@ -56,7 +56,7 @@ FROM
FROM FROM
( (
SELECT click.partition_date,click.cl_id,click.type,mas.active_type,mas.device_type,mas.channel SELECT click.partition_date,click.cl_id,click.type,mas.active_type,mas.device_os_type,mas.channel
FROM FROM
( --浏览需要去掉疑似机构刷量的设备 ( --浏览需要去掉疑似机构刷量的设备
SELECT pv.partition_date as partition_date,pv.cl_id as cl_id,type SELECT pv.partition_date as partition_date,pv.cl_id as cl_id,type
...@@ -305,7 +305,7 @@ FROM ...@@ -305,7 +305,7 @@ FROM
AND click.partition_date=mas.partition_date AND click.partition_date=mas.partition_date
)t1 )t1
LATERAL VIEW explode(t1.channel) t2 AS channel LATERAL VIEW explode(t1.channel) t2 AS channel
GROUP BY t1.partition_date,t1.device_type,t1.active_type,t2.channel GROUP BY t1.partition_date,t1.device_os_type,t1.active_type,t2.channel
)T1 )T1
ORDER BY `日期` desc,`设备类型`,`活跃类型`,`渠道` ORDER BY `日期` desc,`设备类型`,`活跃类型`,`渠道`
...@@ -30,7 +30,7 @@ SELECT `日期`,`设备类型`,`活跃类型`,`渠道` ...@@ -30,7 +30,7 @@ SELECT `日期`,`设备类型`,`活跃类型`,`渠道`
FROM FROM
( (
SELECT t1.partition_date as `日期` SELECT t1.partition_date as `日期`
,t1.device_type as `设备类型` ,t1.device_os_type as `设备类型`
,t1.active_type as `活跃类型` ,t1.active_type as `活跃类型`
,t2.channel as `渠道` ,t2.channel as `渠道`
,count(distinct case when type='美购详情页' then cl_id end ) as `美购详情页浏览uv` ,count(distinct case when type='美购详情页' then cl_id end ) as `美购详情页浏览uv`
...@@ -50,7 +50,7 @@ FROM ...@@ -50,7 +50,7 @@ FROM
FROM FROM
( (
SELECT click.partition_date,click.cl_id,click.type,mas.active_type,mas.device_type,mas.channel SELECT click.partition_date,click.cl_id,click.type,mas.active_type,mas.device_os_type,mas.channel
FROM FROM
( --浏览需要去掉疑似机构刷量的设备 ( --浏览需要去掉疑似机构刷量的设备
SELECT pv.partition_date as partition_date,pv.cl_id as cl_id,type SELECT pv.partition_date as partition_date,pv.cl_id as cl_id,type
...@@ -279,6 +279,6 @@ FROM ...@@ -279,6 +279,6 @@ FROM
AND click.partition_date=mas.partition_date AND click.partition_date=mas.partition_date
)t1 )t1
LATERAL VIEW explode(t1.channel) t2 AS channel LATERAL VIEW explode(t1.channel) t2 AS channel
GROUP BY t1.partition_date,t1.device_type,t1.active_type,t2.channel GROUP BY t1.partition_date,t1.device_os_type,t1.active_type,t2.channel
)T1 )T1
ORDER BY `日期` desc,`设备类型`,`活跃类型`,`渠道` ORDER BY `日期` desc,`设备类型`,`活跃类型`,`渠道`
\ No newline at end of file
SELECT T1.partition_date as `日期` SELECT T1.partition_date as `日期`
,T1.device_type as `设备类型` ,T1.device_os_type as `设备类型`
,T1.active_type as `活跃类型` ,T1.active_type as `活跃类型`
,T1.channel as `渠道` ,T1.channel as `渠道`
,T1.wel_pv as `美购详情页pv` ,T1.wel_pv as `美购详情页pv`
...@@ -173,7 +173,7 @@ SELECT T1.partition_date as `日期` ...@@ -173,7 +173,7 @@ SELECT T1.partition_date as `日期`
FROM FROM
(--能够走向美购详情页的各页面pv/uv (--能够走向美购详情页的各页面pv/uv
SELECT t1.partition_date SELECT t1.partition_date
,t1.device_type ,t1.device_os_type
,t1.active_type ,t1.active_type
,t2.channel ,t2.channel
,count(case when page_name = 'welfare_detail' then t1.cl_id end) as wel_pv ,count(case when page_name = 'welfare_detail' then t1.cl_id end) as wel_pv
...@@ -194,7 +194,7 @@ FROM ...@@ -194,7 +194,7 @@ FROM
,count(case when page_name in ('report_result','face_detect_result') then t1.cl_id end) as ai_report_pv --待之后增加模拟整形页面 ,count(case when page_name in ('report_result','face_detect_result') then t1.cl_id end) as ai_report_pv --待之后增加模拟整形页面
FROM FROM
( (
SELECT t1.partition_date,t1.page_name,t1.cl_id,mas.device_type,mas.active_type,mas.channel SELECT t1.partition_date,t1.page_name,t1.cl_id,mas.device_os_type,mas.active_type,mas.channel
FROM FROM
( (
SELECT partition_date,page_name,cl_id SELECT partition_date,page_name,cl_id
...@@ -257,12 +257,12 @@ FROM ...@@ -257,12 +257,12 @@ FROM
WHERE spam_pv.cl_id IS NULL WHERE spam_pv.cl_id IS NULL
)t1 )t1
LATERAL VIEW explode(t1.channel) t2 AS channel LATERAL VIEW explode(t1.channel) t2 AS channel
GROUP BY t1.partition_date,t1.device_type,t1.active_type,t2.channel GROUP BY t1.partition_date,t1.device_os_type,t1.active_type,t2.channel
)T1 )T1
LEFT JOIN LEFT JOIN
(--不同referrer下的美购详情页pv/uv (--不同referrer下的美购详情页pv/uv
SELECT t1.partition_date SELECT t1.partition_date
,t1.device_type ,t1.device_os_type
,t1.active_type ,t1.active_type
,t2.channel ,t2.channel
,count(case when referrer = 'welfare_detail' then t1.cl_id end) as wel_pv ,count(case when referrer = 'welfare_detail' then t1.cl_id end) as wel_pv
...@@ -283,7 +283,7 @@ FROM ...@@ -283,7 +283,7 @@ FROM
,count(case when referrer in ('report_result','face_detect_result') then t1.cl_id end) as ai_report_pv --待之后增加模拟整形页面 ,count(case when referrer in ('report_result','face_detect_result') then t1.cl_id end) as ai_report_pv --待之后增加模拟整形页面
FROM FROM
( (
SELECT t1.partition_date,t1.referrer,t1.cl_id,mas.device_type,mas.active_type,mas.channel SELECT t1.partition_date,t1.referrer,t1.cl_id,mas.device_os_type,mas.active_type,mas.channel
FROM FROM
( (
SELECT partition_date,referrer,cl_id SELECT partition_date,referrer,cl_id
...@@ -346,16 +346,16 @@ FROM ...@@ -346,16 +346,16 @@ FROM
WHERE spam_pv.cl_id IS NULL WHERE spam_pv.cl_id IS NULL
)t1 )t1
LATERAL VIEW explode(t1.channel) t2 AS channel LATERAL VIEW explode(t1.channel) t2 AS channel
GROUP BY t1.partition_date,t1.device_type,t1.active_type,t2.channel GROUP BY t1.partition_date,t1.device_os_type,t1.active_type,t2.channel
)T2 )T2
ON T1.partition_date=T2.partition_date ON T1.partition_date=T2.partition_date
and T1.device_type=T2.device_type and T1.device_os_type=T2.device_os_type
AND T1.active_type=T2.active_type AND T1.active_type=T2.active_type
AND T1.channel=T2.channel AND T1.channel=T2.channel
LEFT JOIN LEFT JOIN
(--点击加车/支付/私信的不同来源 (--点击加车/支付/私信的不同来源
SELECT t1.partition_date SELECT t1.partition_date
,t1.device_type ,t1.device_os_type
,t1.active_type ,t1.active_type
,t2.channel ,t2.channel
,count(case when referrer = 'welfare_detail' and action = 'welfare_multiattribute_click_add' then t1.cl_id end) as wel_add_pv ,count(case when referrer = 'welfare_detail' and action = 'welfare_multiattribute_click_add' then t1.cl_id end) as wel_add_pv
...@@ -409,7 +409,7 @@ FROM ...@@ -409,7 +409,7 @@ FROM
FROM FROM
( (
SELECT t1.partition_date,t1.referrer,t1.action,t1.cl_id,mas.device_type,mas.active_type,mas.channel SELECT t1.partition_date,t1.referrer,t1.action,t1.cl_id,mas.device_os_type,mas.active_type,mas.channel
FROM FROM
( --点击加车/支付 ( --点击加车/支付
SELECT partition_date,referrer,action,cl_id SELECT partition_date,referrer,action,cl_id
...@@ -503,10 +503,10 @@ FROM ...@@ -503,10 +503,10 @@ FROM
WHERE spam_pv.cl_id IS NULL WHERE spam_pv.cl_id IS NULL
)t1 )t1
LATERAL VIEW explode(t1.channel) t2 AS channel LATERAL VIEW explode(t1.channel) t2 AS channel
GROUP BY t1.partition_date,t1.device_type,t1.active_type,t2.channel GROUP BY t1.partition_date,t1.device_os_type,t1.active_type,t2.channel
)T3 )T3
ON T1.partition_date=T3.partition_date ON T1.partition_date=T3.partition_date
and T1.device_type=T3.device_type and T1.device_os_type=T3.device_os_type
AND T1.active_type=T3.active_type AND T1.active_type=T3.active_type
AND T1.channel=T3.channel AND T1.channel=T3.channel
ORDER BY `日期` desc,`设备类型`,`活跃类型`,`渠道` ORDER BY `日期` desc,`设备类型`,`活跃类型`,`渠道`
\ No newline at end of file
SELECT T1.partition_date as `日期` SELECT T1.partition_date as `日期`
,T1.device_type as `设备类型` ,T1.device_os_type as `设备类型`
,T1.active_type as `活跃类型` ,T1.active_type as `活跃类型`
,T1.channel as `渠道` ,T1.channel as `渠道`
,T1.wel_uv as `美购详情页uv` ,T1.wel_uv as `美购详情页uv`
...@@ -167,7 +167,7 @@ SELECT T1.partition_date as `日期` ...@@ -167,7 +167,7 @@ SELECT T1.partition_date as `日期`
FROM FROM
( (
SELECT t1.partition_date SELECT t1.partition_date
,t1.device_type ,t1.device_os_type
,t1.active_type ,t1.active_type
,t2.channel ,t2.channel
,count(distinct case when page_name = 'welfare_detail' then t1.cl_id end) as wel_uv ,count(distinct case when page_name = 'welfare_detail' then t1.cl_id end) as wel_uv
...@@ -188,7 +188,7 @@ FROM ...@@ -188,7 +188,7 @@ FROM
,count(distinct case when page_name in ('report_result','face_detect_result') then t1.cl_id end) as ai_report_uv --待之后增加模拟整形页面 ,count(distinct case when page_name in ('report_result','face_detect_result') then t1.cl_id end) as ai_report_uv --待之后增加模拟整形页面
FROM FROM
( (
SELECT t1.partition_date,t1.page_name,t1.cl_id,mas.device_type,mas.active_type,mas.channel SELECT t1.partition_date,t1.page_name,t1.cl_id,mas.device_os_type,mas.active_type,mas.channel
FROM FROM
( (
SELECT partition_date,page_name,cl_id SELECT partition_date,page_name,cl_id
...@@ -251,12 +251,12 @@ FROM ...@@ -251,12 +251,12 @@ FROM
WHERE spam_pv.cl_id IS NULL WHERE spam_pv.cl_id IS NULL
)t1 )t1
LATERAL VIEW explode(t1.channel) t2 AS channel LATERAL VIEW explode(t1.channel) t2 AS channel
GROUP BY t1.partition_date,t1.device_type,t1.active_type,t2.channel GROUP BY t1.partition_date,t1.device_os_type,t1.active_type,t2.channel
)T1 )T1
LEFT JOIN LEFT JOIN
(--不同referrer下的美购详情页uv/uv (--不同referrer下的美购详情页uv/uv
SELECT t1.partition_date SELECT t1.partition_date
,t1.device_type ,t1.device_os_type
,t1.active_type ,t1.active_type
,t2.channel ,t2.channel
,count(distinct case when referrer = 'welfare_detail' then t1.cl_id end) as wel_uv ,count(distinct case when referrer = 'welfare_detail' then t1.cl_id end) as wel_uv
...@@ -277,7 +277,7 @@ FROM ...@@ -277,7 +277,7 @@ FROM
,count(distinct case when referrer in ('report_result','face_detect_result') then t1.cl_id end) as ai_report_uv --待之后增加模拟整形页面 ,count(distinct case when referrer in ('report_result','face_detect_result') then t1.cl_id end) as ai_report_uv --待之后增加模拟整形页面
FROM FROM
( (
SELECT t1.partition_date,t1.referrer,t1.cl_id,mas.device_type,mas.active_type,mas.channel SELECT t1.partition_date,t1.referrer,t1.cl_id,mas.device_os_type,mas.active_type,mas.channel
FROM FROM
( (
SELECT partition_date,referrer,cl_id SELECT partition_date,referrer,cl_id
...@@ -340,16 +340,16 @@ FROM ...@@ -340,16 +340,16 @@ FROM
WHERE spam_pv.cl_id IS NULL WHERE spam_pv.cl_id IS NULL
)t1 )t1
LATERAL VIEW explode(t1.channel) t2 AS channel LATERAL VIEW explode(t1.channel) t2 AS channel
GROUP BY t1.partition_date,t1.device_type,t1.active_type,t2.channel GROUP BY t1.partition_date,t1.device_os_type,t1.active_type,t2.channel
)T2 )T2
ON T1.partition_date=T2.partition_date ON T1.partition_date=T2.partition_date
and T1.device_type=T2.device_type and T1.device_os_type=T2.device_os_type
AND T1.active_type=T2.active_type AND T1.active_type=T2.active_type
AND T1.channel=T2.channel AND T1.channel=T2.channel
LEFT JOIN LEFT JOIN
(--点击加车/支付/私信的不同来源 (--点击加车/支付/私信的不同来源
SELECT t1.partition_date SELECT t1.partition_date
,t1.device_type ,t1.device_os_type
,t1.active_type ,t1.active_type
,t2.channel ,t2.channel
,count(distinct case when referrer = 'welfare_detail' and action = 'welfare_multiattribute_click_add' then t1.cl_id end) as wel_add_uv ,count(distinct case when referrer = 'welfare_detail' and action = 'welfare_multiattribute_click_add' then t1.cl_id end) as wel_add_uv
...@@ -403,7 +403,7 @@ FROM ...@@ -403,7 +403,7 @@ FROM
FROM FROM
( (
SELECT t1.partition_date,t1.referrer,t1.action,t1.cl_id,mas.device_type,mas.active_type,mas.channel SELECT t1.partition_date,t1.referrer,t1.action,t1.cl_id,mas.device_os_type,mas.active_type,mas.channel
FROM FROM
( --点击加车/支付 ( --点击加车/支付
SELECT partition_date,referrer,action,cl_id SELECT partition_date,referrer,action,cl_id
...@@ -497,10 +497,10 @@ FROM ...@@ -497,10 +497,10 @@ FROM
WHERE spam_pv.cl_id IS NULL WHERE spam_pv.cl_id IS NULL
)t1 )t1
LATERAL VIEW explode(t1.channel) t2 AS channel LATERAL VIEW explode(t1.channel) t2 AS channel
GROUP BY t1.partition_date,t1.device_type,t1.active_type,t2.channel GROUP BY t1.partition_date,t1.device_os_type,t1.active_type,t2.channel
)T3 )T3
ON T1.partition_date=T3.partition_date ON T1.partition_date=T3.partition_date
and T1.device_type=T3.device_type and T1.device_os_type=T3.device_os_type
AND T1.active_type=T3.active_type AND T1.active_type=T3.active_type
AND T1.channel=T3.channel AND T1.channel=T3.channel
ORDER BY `日期` desc,`设备类型`,`活跃类型`,`渠道` ORDER BY `日期` desc,`设备类型`,`活跃类型`,`渠道`
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment