AND first_channel_source_type not LIKE 'promotion\_jf\_%'
)t1 JOIN
(--卡片,卡片id和session_id去重
SELECT partition_date,
cl_id
from
( SELECT partition_date,
cl_id,
count(distinct app_session_id) as session_pv0
FROM
(
SELECT partition_date,
cl_id,
params['card_id'] as card_id,
app_session_id
from online.bl_hdfs_maidian_updates
WHERE partition_date={partition_day}
AND action='on_click_card'
AND params['page_name'] ='home'
AND params['tab_name'] = '精选'
AND (params['transaction_type'] in ('-1','smr','hotspot','pgc','newdata','hotspot_feed','aistragegy','excestragegy','FIXEDSTRATEGY','FIXEDSTRATEGY_VIDEO')
or params['transaction_type'] like '%ctr' or params['transaction_type'] like '%cvr' or params['transaction_type'] like 'deeplink%')
AND params['card_content_type'] in ('qa','diary','user_post','answer','special_pool')
GROUP BY partition_date,
cl_id,
params['card_id'],
app_session_id
)a
group by partition_date,cl_id,card_id having session_pv0 >0
UNION
SELECT partition_date,
cl_id,
count(distinct card_id) as session_pv0
FROM
(SELECT partition_date,
cl_id,
card_id,
app_session_id
from online.ml_community_precise_exposure_detail
WHERE partition_date={partition_day}
AND action in ('page_precise_exposure','home_choiceness_card_exposure') --7745版本action改为page_precise_exposure
AND is_exposure = '1' ----精准曝光
AND page_name ='home'
AND tab_name = '精选'
AND (transaction_type in ('-1','smr','hotspot','pgc','newdata','hotspot_feed','aistragegy','excestragegy','FIXEDSTRATEGY','FIXEDSTRATEGY_VIDEO')
or transaction_type like '%ctr' or transaction_type like '%cvr' or transaction_type like 'deeplink%')
AND card_content_type in ('qa','diary','user_post','answer','special_pool')
group by partition_date,
cl_id,
card_id,
app_session_id
)a
group by partition_date,cl_id having session_pv0 >= 4) group by partition_date,cl_id