Commit 40140e50 authored by 赵建伟's avatar 赵建伟

Merge branch 'weiyimin' into 'master'

Weiyimin

See merge request !47
parents 97dac580 837ff895
......@@ -26,10 +26,10 @@ SELECT T1.partition_date as day_id
,valid_msg_num
,clue_dev
,clue_num
,call_dev
,call_num
,valid_call_dev
,valid_call_num
,nvl(call_dev,0)
,nvl(call_num,0)
,nvl(valid_call_dev,0)
,nvl(valid_call_num,0)
,msg_dev_4
,msg_num_4
......@@ -37,10 +37,10 @@ SELECT T1.partition_date as day_id
,valid_msg_num_4
,clue_dev_4
,clue_num_4
,call_dev_4
,call_num_4
,valid_call_dev_4
,valid_call_num_4
,nvl(call_dev_4,0)
,nvl(call_num_4,0)
,nvl(valid_call_dev_4,0)
,nvl(valid_call_num_4,0)
,msg_dev_kyc
,msg_num_kyc
......@@ -48,10 +48,10 @@ SELECT T1.partition_date as day_id
,valid_msg_num_kyc
,clue_dev_kyc
,clue_num_kyc
,call_dev_kyc
,call_num_kyc
,valid_call_dev_kyc
,valid_call_num_kyc
,nvl(call_dev_kyc,0)
,nvl(call_num_kyc,0)
,nvl(valid_call_dev_kyc,0)
,nvl(valid_call_num_kyc,0)
,msg_dev_qa
,msg_num_qa
......@@ -59,10 +59,10 @@ SELECT T1.partition_date as day_id
,valid_msg_num_qa
,clue_dev_qa
,clue_num_qa
,call_dev_qa
,call_num_qa
,valid_call_dev_qa
,valid_call_num_qa
,nvl(call_dev_qa,0)
,nvl(call_num_qa,0)
,nvl(valid_call_dev_qa,0)
,nvl(valid_call_num_qa,0)
FROM
(
SELECT mas.partition_date as partition_date
......@@ -71,36 +71,36 @@ FROM
,grey_type
,count(distinct mas.device_id) as dau
,count(distinct a.user_id) as user_num
,count(distinct case when t1.msg_num>0 then t1.user_id end) msg_dev
,sum(t1.msg_num) msg_num
,count(distinct case when t1_v.valid_msg_num>0 then t1_v.user_id end) valid_msg_dev
,sum(t1_v.valid_msg_num) as valid_msg_num
,count(distinct case when t2.clue_num>0 then t2.user_id end) as clue_dev
,sum(t2.clue_num) as clue_num
,nvl(count(distinct case when t1.msg_num>0 then t1.user_id end),0) msg_dev
,nvl(sum(t1.msg_num),0) msg_num
,nvl(count(distinct case when t1_v.valid_msg_num>0 then t1_v.user_id end),0) valid_msg_dev
,nvl(sum(t1_v.valid_msg_num),0) as valid_msg_num
,nvl(count(distinct case when t2.clue_num>0 then t2.user_id end),0) as clue_dev
,nvl(sum(t2.clue_num),0) as clue_num
,count(distinct case when t10.msg_num>0 then t10.user_id end) msg_dev_4
,sum(t10.msg_num) msg_num_4
,count(distinct case when t10_v.valid_msg_num>0 then t10_v.user_id end) valid_msg_dev_4
,sum(t10_v.valid_msg_num) as valid_msg_num_4
,count(distinct case when t11.clue_num>0 then t11.user_id end) as clue_dev_4
,sum(t11.clue_num) as clue_num_4
,nvl(count(distinct case when t10.msg_num>0 then t10.user_id end),0) msg_dev_4
,nvl(sum(t10.msg_num),0) msg_num_4
,nvl(count(distinct case when t10_v.valid_msg_num>0 then t10_v.user_id end),0) valid_msg_dev_4
,nvl(sum(t10_v.valid_msg_num),0) as valid_msg_num_4
,nvl(count(distinct case when t11.clue_num>0 then t11.user_id end),0) as clue_dev_4
,nvl(sum(t11.clue_num),0) as clue_num_4
,count(distinct case when t4.msg_num>0 then t4.user_id end) msg_dev_kyc
,sum(t4.msg_num) msg_num_kyc
,count(distinct case when t4_v.valid_msg_num>0 then t4_v.user_id end) valid_msg_dev_kyc
,sum(t4_v.valid_msg_num) as valid_msg_num_kyc
,count(distinct case when t5.clue_num>0 then t5.user_id end) as clue_dev_kyc
,sum(t5.clue_num) as clue_num_kyc
,nvl(count(distinct case when t4.msg_num>0 then t4.user_id end),0) msg_dev_kyc
,nvl(sum(t4.msg_num),0) msg_num_kyc
,nvl(count(distinct case when t4_v.valid_msg_num>0 then t4_v.user_id end),0) valid_msg_dev_kyc
,nvl(sum(t4_v.valid_msg_num),0) as valid_msg_num_kyc
,nvl(count(distinct case when t5.clue_num>0 then t5.user_id end),0) as clue_dev_kyc
,nvl(sum(t5.clue_num),0) as clue_num_kyc
,count(distinct case when t7.msg_num>0 then t7.user_id end) msg_dev_qa
,sum(t7.msg_num) msg_num_qa
,count(distinct case when t7_v.valid_msg_num>0 then t7_v.user_id end) valid_msg_dev_qa
,sum(t7_v.valid_msg_num) as valid_msg_num_qa
,count(distinct case when t8.clue_num>0 then t8.user_id end) as clue_dev_qa
,sum(t8.clue_num) as clue_num_qa
,nvl(count(distinct case when t7.msg_num>0 then t7.user_id end),0) msg_dev_qa
,nvl(sum(t7.msg_num),0) msg_num_qa
,nvl(count(distinct case when t7_v.valid_msg_num>0 then t7_v.user_id end),0) valid_msg_dev_qa
,nvl(sum(t7_v.valid_msg_num),0) as valid_msg_num_qa
,nvl(count(distinct case when t8.clue_num>0 then t8.user_id end),0) as clue_dev_qa
,nvl(sum(t8.clue_num),0) as clue_num_qa
FROM
(
......@@ -123,13 +123,13 @@ FROM
)mas
left join
(--找出user_id当天活跃的第一个设备id
SELECT user_id,partition_day,
if(size(device_id_list) > 0, device_id_list [ 0 ], '') AS device_id
FROM ml.ml_c_ct_ui_user_dimen_inc_d
WHERE partition_day>=REGEXP_REPLACE(trunc(date_sub(current_date(),1),'MM'),'-','')
AND partition_day<= regexp_replace(date_sub(current_date,1),'-','')
SELECT user_id,partition_date,
if(size(device_list) > 0, device_list [ 0 ], '') AS device_id
FROM online.ml_user_updates
WHERE partition_date>=REGEXP_REPLACE(trunc(date_sub(current_date(),1),'MM'),'-','')
AND partition_date<= regexp_replace(date_sub(current_date,1),'-','')
)a
on mas.partition_date=a.partition_day and mas.device_id=a.device_id
on mas.partition_date=a.partition_date and mas.device_id=a.device_id
left join
(--私信线索总数
SELECT msg.partition_date,user_id
......@@ -144,7 +144,7 @@ FROM
)msg
GROUP BY msg.partition_date,user_id
)t1
ON a.partition_day = t1.partition_date and a.user_id=t1.user_id
ON a.partition_date = t1.partition_date and a.user_id=t1.user_id
left join
(--有效私信线索总数
SELECT msg.partition_date,user_id
......@@ -160,7 +160,7 @@ FROM
)msg
GROUP BY msg.partition_date,user_id
)t1_v
ON a.partition_day = t1_v.partition_date and a.user_id=t1_v.user_id
ON a.partition_date = t1_v.partition_date and a.user_id=t1_v.user_id
LEFT JOIN
( --电话线索总数
SELECT partition_date,user_id,count(1) AS clue_num
......@@ -175,7 +175,7 @@ FROM
)a
GROUP BY partition_date,user_id
)t2
ON a.partition_day = t2.partition_date and a.user_id=t2.user_id
ON a.partition_date = t2.partition_date and a.user_id=t2.user_id
left join
(--kyc私信
......@@ -206,7 +206,7 @@ FROM
)msg
group by msg.partition_date,user_id
)t4
on a.partition_day=t4.partition_date and a.user_id=t4.user_id
on a.partition_date=t4.partition_date and a.user_id=t4.user_id
left join
(--kyc有效私信
SELECT msg.partition_date,user_id
......@@ -237,7 +237,7 @@ FROM
)msg
group by msg.partition_date,user_id
)t4_v
on a.partition_day=t4_v.partition_date and a.user_id=t4_v.user_id
on a.partition_date=t4_v.partition_date and a.user_id=t4_v.user_id
LEFT JOIN
( --kyc电话线索总数
SELECT partition_date,user_id,count(1) as clue_num
......@@ -288,7 +288,7 @@ FROM
)a
group by partition_date,user_id
)t5
ON a.partition_day = t5.partition_date and a.user_id=t5.user_id
ON a.partition_date = t5.partition_date and a.user_id=t5.user_id
left join
(--需求自测私信
......@@ -342,7 +342,7 @@ FROM
)msg
group by msg.partition_date,user_id
)t7
on a.partition_day=t7.partition_date and a.user_id=t7.user_id
on a.partition_date=t7.partition_date and a.user_id=t7.user_id
left join
(--需求自测有效私信
SELECT msg.partition_date,user_id
......@@ -396,7 +396,7 @@ FROM
)msg
group by msg.partition_date,user_id
)t7_v
on a.partition_day=t7_v.partition_date and a.user_id=t7_v.user_id
on a.partition_date=t7_v.partition_date and a.user_id=t7_v.user_id
LEFT JOIN
( --需求自测电话线索总数
SELECT partition_date,user_id,count(1) as clue_num
......@@ -429,7 +429,7 @@ FROM
)a
group by partition_date,user_id
)t8
ON a.partition_day = t8.partition_date and a.user_id=t8.user_id
ON a.partition_date = t8.partition_date and a.user_id=t8.user_id
left join
(--t4以上商户私信线索总数
......@@ -459,7 +459,7 @@ FROM
on msg.merchant_id=b.merchant_id
GROUP BY msg.partition_date,user_id
)t10
ON a.partition_day = t10.partition_date and a.user_id=t10.user_id
ON a.partition_date = t10.partition_date and a.user_id=t10.user_id
left join
(--t4以上商户有效私信线索总数
SELECT msg.partition_date,user_id
......@@ -489,7 +489,7 @@ FROM
on msg.merchant_id=b.merchant_id
GROUP BY msg.partition_date,user_id
)t10_v
ON a.partition_day = t10_v.partition_date and a.user_id=t10_v.user_id
ON a.partition_date = t10_v.partition_date and a.user_id=t10_v.user_id
left join
(--t4以上商户电话线索总数
SELECT partition_date,user_id,count(1) AS clue_num
......@@ -518,31 +518,33 @@ FROM
on a.merchant_id=b.merchant_id
GROUP BY partition_date,user_id
)t11
ON a.partition_day = t11.partition_date and a.user_id=t11.user_id
ON a.partition_date = t11.partition_date and a.user_id=t11.user_id
group by mas.partition_date,device_os_type,active_type,grey_type
)T1
LEFT JOIN
(
SELECT t3.partition_date,a.device_os_type,'老活跃设备'as active_type,a.grey_type
,count(distinct case when t3.call_num>0 then t3.user_id end) as call_dev
,sum(t3.call_num) as call_num
,count(distinct case when t3_v.valid_call_num>0 then t3_v.user_id end) as valid_call_dev
,sum(t3_v.valid_call_num) as valid_call_num
SELECT t3.partition_date,a.device_os_type,a.grey_type
,case when b.active_type in ('1','2') then '新增设备'
when (b.active_type ='4' or b.active_type is null) then '老活跃设备' end as active_type
,nvl(count(distinct case when t3.call_num>0 then t3.user_id end),0) as call_dev
,nvl(sum(t3.call_num),0) as call_num
,nvl(count(distinct case when t3_v.valid_call_num>0 then t3_v.user_id end),0) as valid_call_dev
,nvl(sum(t3_v.valid_call_num),0) as valid_call_num
,count(distinct case when t12.call_num>0 then t12.user_id end) as call_dev_4
,sum(t12.call_num) as call_num_4
,count(distinct case when t12_v.valid_call_num>0 then t12_v.user_id end) as valid_call_dev_4
,sum(t12_v.valid_call_num) as valid_call_num_4
,nvl(count(distinct case when t12.call_num>0 then t12.user_id end),0) as call_dev_4
,nvl(sum(t12.call_num),0) as call_num_4
,nvl(count(distinct case when t12_v.valid_call_num>0 then t12_v.user_id end),0) as valid_call_dev_4
,nvl(sum(t12_v.valid_call_num),0) as valid_call_num_4
,count(distinct case when t6.call_num>0 then t6.user_id end) as call_dev_kyc
,sum(t6.call_num) as call_num_kyc
,count(distinct case when t6_v.valid_call_num>0 then t6_v.user_id end) as valid_call_dev_kyc
,sum(t6_v.valid_call_num) as valid_call_num_kyc
,nvl(count(distinct case when t6.call_num>0 then t6.user_id end),0) as call_dev_kyc
,nvl(sum(t6.call_num),0) as call_num_kyc
,nvl(count(distinct case when t6_v.valid_call_num>0 then t6_v.user_id end),0) as valid_call_dev_kyc
,nvl(sum(t6_v.valid_call_num),0) as valid_call_num_kyc
,count(distinct case when t9.call_num>0 then t9.user_id end) as call_dev_qa
,sum(t9.call_num) as call_num_qa
,count(distinct case when t9_v.valid_call_num>0 then t9_v.user_id end) as valid_call_dev_qa
,sum(t9_v.valid_call_num) as valid_call_num_qa
,nvl(count(distinct case when t9.call_num>0 then t9.user_id end),0) as call_dev_qa
,nvl(sum(t9.call_num),0) as call_num_qa
,nvl(count(distinct case when t9_v.valid_call_num>0 then t9_v.user_id end),0) as valid_call_dev_qa
,nvl(sum(t9_v.valid_call_num),0) as valid_call_num_qa
FROM
(
......@@ -553,24 +555,25 @@ LEFT JOIN
,array(case when substr(convup(setencryption(device_id,'sha-1'),16,10),-2,2)%20 = 0 then 'kyc灰度' else '非灰' end,'合计') as grey_type
FROM
(
SELECT device_id,device_os_type,a.user_id
,row_number() over(partition by device_id order by a.partition_day desc) as rn
SELECT device_id,device_os_type,a.user_id,a.partition_date
,row_number() over(partition by device_id order by a.partition_date desc) as rn
FROM
(
SELECT device_id,device_os_type,v.user_id,partition_day
FROM ml.mid_ml_c_ct_dv_device_inc_d
LATERAL VIEW EXPLODE(user_id_list) v as user_id
where partition_day>='20200801' and partition_day<=regexp_replace(date_sub(current_date(),1),'-','')
SELECT device_id,v.device_os_type,v.user_id,partition_date
FROM online.ml_device_updates
LATERAL VIEW EXPLODE(user_list) v as user_id
LATERAL VIEW EXPLODE(device_os_type) v as device_os_type
where partition_date>='20200801' and partition_date<=regexp_replace(date_sub(current_date(),1),'-','')
)a--由于要取近期该设备用过的user_id,故时间取的较长,避免用公式而将月末数据少算
join
(
SELECT partition_day,user_id
FROM ml.ml_c_ct_ui_user_dimen_inc_d
where partition_day>='20200801' and partition_day<=regexp_replace(date_sub(current_date(),1),'-','')
and size(user_phone_list)>0
group by partition_day,user_id
SELECT partition_date,user_id
FROM online.ml_user_updates
where partition_date>='20200801' and partition_date<=regexp_replace(date_sub(current_date(),1),'-','')
and phone is not null and phone <>''
group by partition_date,user_id
)b
on a.partition_day=b.partition_day and a.user_id=b.user_id
on a.partition_date=b.partition_date and a.user_id=b.user_id
)c
where rn=1
)d
......@@ -628,6 +631,18 @@ LEFT JOIN
GROUP BY user_id,partition_date
)t3
ON a.user_id=t3.user_id
left join
(
SELECT
partition_date
,device_id
,active_type
FROM online.ml_device_day_active_status
where partition_date>=REGEXP_REPLACE(trunc(date_sub(current_date(),1),'MM'),'-','')
AND partition_date<=regexp_replace(date_sub(current_date,1),'-','')
AND active_type in ('1','2','4')
)b
on t3.partition_date=b.partition_date and a.device_id=b.device_id
LEFT JOIN
( ---拨打电话线索
SELECT partition_date,user_id
......@@ -1120,9 +1135,10 @@ LEFT JOIN
GROUP BY user_id,partition_date
)t12_v
ON t3.partition_date = t12_v.partition_date and t3.user_id=t12_v.user_id
group by t3.partition_date,a.device_os_type,a.grey_type
group by t3.partition_date,a.device_os_type,a.grey_type,case when b.active_type in ('1','2') then '新增设备'
when (b.active_type ='4' or b.active_type is null) then '老活跃设备' end
)T2
on T1.partition_date=T2.partition_date
AND T1.device_os_type=T2.device_os_type
AND T1.active_type=T2.active_type
AND T1.grey_type=T2.grey_type;
AND T1.grey_type=T2.grey_type
#step3.job
type=command
dependencies=step2
command=curl -X GET http://localhost:8553/api/report/email/clue_daily/weiyimin@igengmei.com/weiyimin@qq.com
\ No newline at end of file
command=curl -X GET http://localhost:8553/api/report/email/clue_daily/liudi@igengmei.com,wangxin@igengmei.com,zhaoyang@igengmei.com/weiyimin@igengmei.com
\ No newline at end of file
......@@ -37,7 +37,7 @@ FROM
WHEN active_type IN ('1','2') THEN '新增' END AS active_type
,device_id
FROM online.ml_device_day_active_status
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
WHERE partition_date>='20200101' and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND active_type IN ('1','2','4')
AND first_channel_source_type not IN ('yqxiu1','yqxiu2','yqxiu3','yqxiu4','yqxiu5','mxyc1','mxyc2','mxyc3'
,'wanpu','jinshan','jx','maimai','zhuoyi','huatian','suopingjingling','mocha','mizhe','meika','lamabang'
......@@ -53,7 +53,7 @@ FROM
SELECT partition_date,
card_content_type,
cl_id,
recommend_type,
v.recommend_type,
card_id,
count(distinct app_session_id) as session_pv
FROM
......@@ -61,18 +61,17 @@ FROM
SELECT partition_date,
cl_id,
case when card_content_type in ('qa','answer') then 'qa' else card_content_type end as card_content_type,
CASE when transaction_type in ('fmctr') then 'fmctr'
WHEN transaction_type like '%ctr' THEN 'ctr预估'
WHEN transaction_type like '%cvr' THEN 'cvr预估'
WHEN transaction_type in ('-1','smr') THEN 'smr'
when transaction_type in ('pgc','hotspot') then '热点卡片'
when transaction_type in ('newdata') then '保量卡片'
when transaction_type in ('hotspot_feed') then 'hotspot_feed'
END AS recommend_type,
CASE when transaction_type in ('fmctr') then array('fmctr','合计')
WHEN transaction_type like '%ctr' THEN array('ctr预估','合计')
WHEN transaction_type like '%cvr' THEN array('cvr预估','合计')
WHEN transaction_type in ('-1','smr') THEN array('smr','合计')
when transaction_type in ('pgc','hotspot') then array('热点卡片','合计')
when transaction_type in ('newdata') then array('保量卡片')
when transaction_type in ('hotspot_feed') then array('hotspot_feed','合计') end AS recommend_type,
card_id,
app_session_id
from online.ml_community_precise_exposure_detail
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
WHERE partition_date>='20200101' and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND action in ('page_precise_exposure','home_choiceness_card_exposure') --7745版本action改为page_precise_exposure
AND is_exposure = '1' ----精准曝光
AND page_name ='home'
......@@ -83,17 +82,18 @@ FROM
group by partition_date,
case when card_content_type in ('qa','answer') then 'qa' else card_content_type end,
cl_id,
CASE when transaction_type in ('fmctr') then 'fmctr'
WHEN transaction_type like '%ctr' THEN 'ctr预估'
WHEN transaction_type like '%cvr' THEN 'cvr预估'
WHEN transaction_type in ('-1','smr') THEN 'smr'
when transaction_type in ('pgc','hotspot') then '热点卡片'
when transaction_type in ('newdata') then '保量卡片'
when transaction_type in ('hotspot_feed') then 'hotspot_feed' END,
CASE when transaction_type in ('fmctr') then array('fmctr','合计')
WHEN transaction_type like '%ctr' THEN array('ctr预估','合计')
WHEN transaction_type like '%cvr' THEN array('cvr预估','合计')
WHEN transaction_type in ('-1','smr') THEN array('smr','合计')
when transaction_type in ('pgc','hotspot') then array('热点卡片','合计')
when transaction_type in ('newdata') then array('保量卡片')
when transaction_type in ('hotspot_feed') then array('hotspot_feed','合计')end,
card_id,
app_session_id
)a
group by partition_date,card_content_type,cl_id,recommend_type,card_id
LATERAL VIEW explode (a.recommend_type) v as recommend_type
group by partition_date,card_content_type,cl_id,v.recommend_type,card_id
)t2
on t1.device_id=t2.cl_id and t1.partition_date=t2.partition_date
LEFT JOIN
......@@ -101,7 +101,7 @@ FROM
SELECT partition_date,
card_content_type,
cl_id,
recommend_type,
v.recommend_type,
card_id,
count(distinct app_session_id) as session_pv
FROM
......@@ -109,18 +109,17 @@ FROM
SELECT partition_date,
cl_id,
case when params['card_content_type'] in ('qa','answer') then 'qa' else params['card_content_type'] end as card_content_type,
CASE when params['transaction_type'] in ('fmctr') then 'fmctr'
WHEN params['transaction_type'] like '%ctr' THEN 'ctr预估'
WHEN params['transaction_type'] like '%cvr' THEN 'cvr预估'
WHEN params['transaction_type'] in ('-1','smr') THEN 'smr'
when params['transaction_type'] in ('pgc','hotspot') then '热点卡片'
when params['transaction_type'] in ('newdata') then '保量卡片'
when params['transaction_type'] in ('hotspot_feed') then 'hotspot_feed'
END AS recommend_type,
CASE when params['transaction_type'] in ('fmctr') then array('fmctr','合计')
WHEN params['transaction_type'] like '%ctr' THEN array('ctr预估','合计')
WHEN params['transaction_type'] like '%cvr' THEN array('cvr预估','合计')
WHEN params['transaction_type'] in ('-1','smr') THEN array('smr','合计')
when params['transaction_type'] in ('pgc','hotspot') then array('热点卡片','合计')
when params['transaction_type'] in ('newdata') then array('保量卡片')
when params['transaction_type'] in ('hotspot_feed') then array('hotspot_feed','合计')end AS recommend_type,
params['card_id'] as card_id,
app_session_id
from online.bl_hdfs_maidian_updates
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
WHERE partition_date>='20200101' and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND action='on_click_card'
AND params['page_name'] ='home'
AND params['tab_name'] = '精选'
......@@ -130,17 +129,18 @@ FROM
GROUP BY partition_date,
cl_id,
case when params['card_content_type'] in ('qa','answer') then 'qa' else params['card_content_type'] end,
CASE when params['transaction_type'] in ('fmctr') then 'fmctr'
WHEN params['transaction_type'] like '%ctr' THEN 'ctr预估'
WHEN params['transaction_type'] like '%cvr' THEN 'cvr预估'
WHEN params['transaction_type'] in ('-1','smr') THEN 'smr'
when params['transaction_type'] in ('pgc','hotspot') then '热点卡片'
when params['transaction_type'] in ('newdata') then '保量卡片'
when params['transaction_type'] in ('hotspot_feed') then 'hotspot_feed' END,
CASE when params['transaction_type'] in ('fmctr') then array('fmctr','合计')
WHEN params['transaction_type'] like '%ctr' THEN array('ctr预估','合计')
WHEN params['transaction_type'] like '%cvr' THEN array('cvr预估','合计')
WHEN params['transaction_type'] in ('-1','smr') THEN array('smr','合计')
when params['transaction_type'] in ('pgc','hotspot') then array('热点卡片','合计')
when params['transaction_type'] in ('newdata') then array('保量卡片')
when params['transaction_type'] in ('hotspot_feed') then array('hotspot_feed','合计')end,
params['card_id'],
app_session_id
)a
group by partition_date,card_content_type,cl_id,recommend_type,card_id
LATERAL VIEW explode (a.recommend_type) v as recommend_type
group by partition_date,card_content_type,cl_id,v.recommend_type,card_id
)t3
on t2.partition_date=t3.partition_date
and t2.cl_id=t3.cl_id
......@@ -155,7 +155,7 @@ FROM
when page_name in ('question_detail','answer_detail','question_answer_detail') then 'qa' else null end as page_name,
sum(page_stay) as page_stay
FROM online.bl_hdfs_maidian_updates
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
WHERE partition_date>='20200101' and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND action='page_view'
AND page_name IN ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail')
AND referrer='home'
......@@ -177,7 +177,7 @@ FROM
when page_name in ('question_detail','answer_detail','question_answer_detail') then 'qa' else null end as page_name,
count(1) as navbar_pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
WHERE partition_date>='20200101' and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND action in ('on_click_navbar_search','do_search')
AND page_name IN ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail')
AND (referrer='home' or
......@@ -200,7 +200,7 @@ FROM
when page_name in ('question_detail','answer_detail','question_answer_detail') then 'qa' else null end as page_name,
count(1) as highlight_pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
WHERE partition_date>='20200101' and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND action='on_click_card'
and params['card_type']='highlight_word'
AND page_name IN ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail')
......@@ -227,7 +227,7 @@ FROM
when page_name in ('question_detail','answer_detail','question_answer_detail') then 'qa' else null end as page_name,
count(1) as pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
WHERE partition_date>='20200101' and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND (get_json_object(params['extra_param'], '$.type')='交互栏'
or get_json_object(params['extra_param'], '$.jump_from')='msg_link'
or params['in_page_pos']='top'
......@@ -261,7 +261,7 @@ FROM
when page_name in ('question_detail','answer_detail','question_answer_detail') then 'qa' else null end as page_name,
count(1) as service_pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
WHERE partition_date>='20200101' and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND (action='on_click_card'and params['card_content_type']='service'
or action='on_click_button' and params['button_name']='unfold' and page_name in ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail')
or action='on_click_button' and params['button_name'] = 'more_recommendations')
......@@ -291,7 +291,7 @@ FROM
when page_name in ('question_detail','answer_detail','question_answer_detail') then 'qa' else null end as page_name,
count(1) as service_pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
WHERE partition_date>='20200101' and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND action='on_click_card'
and params['card_content_type'] in ('qa','diary','user_post','answer')
AND page_name IN ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail')
......@@ -317,7 +317,7 @@ FROM
when page_name in ('question_detail','answer_detail','question_answer_detail') then 'qa' else null end as page_name,
count(1) as video_pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
WHERE partition_date>='20200101' and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND action='on_click_button'
and params['button_name']='video_interview'
AND page_name IN ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail')
......@@ -341,7 +341,7 @@ FROM
when page_name in ('question_detail','answer_detail','question_answer_detail') then 'qa' else null end as page_name,
count(1) as referral_pv
FROM online.bl_hdfs_maidian_updates
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
WHERE partition_date>='20200101' and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
AND action='on_click_button'
and params['button_name']='referral'
AND page_name IN ('diary_detail','topic_detail','post_detail','user_post_detail','doctor_post_detail','question_detail','answer_detail','question_answer_detail')
......@@ -377,7 +377,7 @@ FROM
SELECT user_id,partition_date,
if(size(device_list) > 0, device_list [ 0 ], '') AS device_id
FROM online.ml_user_updates
WHERE partition_date=regexp_replace(DATE_SUB(current_date,1) ,'-','')
WHERE partition_date>='20200101' and partition_date<=regexp_replace(DATE_SUB(current_date,1) ,'-','')
)t1
JOIN
( --医生账号
......
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