Advertisement
Guest User

Untitled

a guest
Aug 13th, 2014
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. SELECT
  2. suc.n_way_test_choice_id as 239_test_groups,
  3. AVG(suc.cnt) as avg,
  4. VARIANCE(suc.cnt) as var,
  5. count(suc.cnt) as sample_size
  6. FROM (
  7. SELECT
  8. nwta.n_way_test_choice_id,
  9. count(
  10. distinct(
  11. if(click.ds <= pi.start_date, pi.interaction_id, null)
  12. )
  13. ) as cnt
  14. FROM (
  15. SELECT distinct(user_id) as user_id
  16. FROM warehouse.recommendation_views rv
  17. WHERE rv.page='home'
  18. -- AND rv.platform in ('mobile_ios', 'mobile_android')
  19. AND substr(reverse(rv.module_id),0,1)='='
  20. AND rv.ds >= "2014-08-04"
  21. AND rv.ds <= "2014-08-12"
  22. ) users
  23. JOIN oltp.n_way_test_assignments nwta
  24. ON `nwta`.word_user_id = users.user_id
  25. AND nwta.n_way_test_choice_id in (576, 577)
  26. LEFT OUTER JOIN `stats`.pmp_interactions pi
  27. ON pi.reader_id = users.user_id
  28. AND pi.total_view_time >= 10
  29. LEFT OUTER JOIN warehouse.recommendation_clicks click
  30. ON click.ds >= "2014-08-04"
  31. AND click.ds <= "2014-08-12"
  32. AND click.rec_doc_id = pi.doc_id
  33. AND click.user_id = users.user_id
  34. AND click.page='home'
  35. -- AND click.platform in ('mobile_ios', 'mobile_android')
  36. AND substr(reverse(click.rec_id),0,1)='='
  37. GROUP BY users.user_id, nwta.n_way_test_choice_id
  38. HAVING cnt < 10
  39. ) suc
  40. GROUP BY suc.n_way_test_choice_id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement