-- 排查：所有实验组 多天 dau 趋势对比
-- 检查是单组问题还是全局问题

SELECT  dt
        ,CASE   WHEN abcode IN ('ab0','ab1') THEN '实验组-先验地域降权'
                WHEN abcode IN ('ab6','ab7') THEN '实验组-str+校准&ros-统计量'
                WHEN abcode IN ('ab8','ab9') THEN '实验组-str+校准'
                WHEN abcode IN ('ab2','ab3') THEN '对照组'
                WHEN abcode IN ('ab4','ab5') THEN 'ab4-5'
                ELSE '其他'
        END AS abcode_group
        ,abcode AS abcode_raw
        ,COUNT(1) AS exp_cnt
        ,COUNT(DISTINCT mid) AS dau
        ,COUNT(DISTINCT vid) AS vid_cnt
        ,round(COUNT(1) / COUNT(DISTINCT mid), 2) AS exp_per_dau
        -- 检查过滤条件的影响
        ,SUM(CASE WHEN extend_alg IS NULL THEN 1 ELSE 0 END) AS null_extend_alg
        ,SUM(CASE WHEN GET_JSON_OBJECT(extend_alg,'$.scoresMap') IS NULL THEN 1 ELSE 0 END) AS null_scoresmap
        ,SUM(CASE WHEN page NOT IN ('回流后沉浸页&内页feed','详情后沉浸页','首页feed','详情页') THEN 1 ELSE 0 END) AS non_rec_page
FROM    loghubods.dwd_recsys_alg_sample_all_20250212
WHERE   dt BETWEEN '20260120' AND '20260127'
AND     apptype = '4'
AND     abcode IN ('ab0','ab1','ab2','ab3','ab4','ab5','ab6','ab7','ab8','ab9')
GROUP BY dt, abcode
ORDER BY dt, abcode_group, abcode
;
