Advertisement
kirzecy670

Untitled

Aug 22nd, 2024
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. WITH
  2. pp as (SELECT uid from analytics.parent_properties p
  3.     WHERE p.full_reg_datetime >= '2024-08-12'
  4.           AND p.is_full_register
  5.           AND child_android_cnt >= 1 AND platform = 'Android'
  6.           AND p.uid IS NOT NULL),
  7. reinstall AS (
  8.     SELECT DISTINCT uid
  9.     FROM stat.funnelTrack
  10.     WHERE dt >= '2023-06-01'
  11.         AND action IN (
  12.             'reinstall_detected',
  13.             'migration_gmd_received',
  14.             'migration_success_show'
  15.         )
  16.         OR (action IN ('bind_user', 'rebind_user')
  17.             AND visitParamExtractString(addJson, 'reason') IN ('moveGlobalToRu', 'migration', 'adid'))
  18. ),
  19. rebind_user AS (
  20.     SELECT DISTINCT device_id AS uid
  21.     FROM billing.a_device_event
  22.     WHERE ts >= '2023-06-01'
  23.         AND type = 'rebind_user'
  24. ),
  25. app_stat_users AS (
  26.     SELECT
  27.         ft.uid as uid
  28.     FROM
  29.         stat.funnelTrack AS ft
  30.     WHERE
  31.         ft.dt >= '2024-08-01'
  32.         AND ft.action = 'open_function_appstat'
  33.     GROUP BY
  34.         ft.uid
  35. ),
  36. android_parent AS (
  37.    select uid
  38.    from analytics.parent_properties
  39.    where child_android_cnt >= 1
  40.     AND full_reg_datetime >= '2024-08-01'
  41.     AND is_full_register
  42. ),
  43. exp_users AS (
  44.     SELECT
  45.         ft.uid as uid,
  46.         MAX(visitParamExtractString(ft.addJson, 'option')) AS exp_group
  47.     FROM
  48.         stat.funnelTrack AS ft
  49.     LEFT ANTI JOIN reinstall AS ri ON ft.uid = ri.uid
  50.     LEFT ANTI JOIN rebind_user AS rb ON ft.uid = rb.uid
  51.     JOIN android_parent ap on ap.uid =  ft.uid
  52.     JOIN pp on ft.uid = pp.uid
  53.    
  54.     -- LEFT ANTI JOIN app_stat_users AS asu ON ft.uid = asu.uid
  55.     WHERE
  56.         ft.dt >= '2024-08-01' and ft.dt <= '2024-09-01'
  57.         AND ft.action = 'pteam_appstat_and_blocking_v2_parents'
  58.     GROUP BY
  59.         ft.uid
  60.     HAVING exp_group in ('old', 'new')
  61. )
  62. SELECT exp_group, count(*) as n from exp_users group by 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement