-- 曝光样本表天级别数据统计
SELECT
    dt,
    COUNT(1) AS exposure_pv,
    COUNT(DISTINCT uid) AS exposure_uv,
    COUNT(DISTINCT vid) AS video_cnt,
    COUNT(DISTINCT mid) AS mid_cnt,
    -- 分享指标
    SUM(CASE WHEN is_share = '1' THEN 1 ELSE 0 END) AS share_pv,
    COUNT(DISTINCT CASE WHEN is_share = '1' THEN uid END) AS share_uv,
    -- 一次回流指标
    SUM(CASE WHEN is_return_1 = '1' THEN 1 ELSE 0 END) AS return_1_pv,
    COUNT(DISTINCT CASE WHEN is_return_1 = '1' THEN uid END) AS return_1_uv,
    -- 多次回流指标
    SUM(CASE WHEN is_return_n = '1' THEN 1 ELSE 0 END) AS return_n_pv,
    COUNT(DISTINCT CASE WHEN is_return_n = '1' THEN uid END) AS return_n_uv
FROM loghubods.dwd_recsys_alg_exposure_base_20250108
WHERE dt BETWEEN '${start}' AND '${end}'
GROUP BY dt
ORDER BY dt
