Skip to content

Instantly share code, notes, and snippets.

@saptarshiguha
Created September 1, 2016 21:28
Show Gist options
  • Select an option

  • Save saptarshiguha/df8b9c73d15956c7bb36e05aec058585 to your computer and use it in GitHub Desktop.

Select an option

Save saptarshiguha/df8b9c73d15956c7bb36e05aec058585 to your computer and use it in GitHub Desktop.
x0 = sqlContext.sql("""
select
client_id,
substr(subsession_start_date,0,10) as date,
case when (sum(plugin_hangs) + sum(crashes_detected_plugin) + sum(crashes_detected_gmplugin )) > 0 then 1 else 0 end as cpq,
case when sum(crashes_detected_content)>0 then 1 else 0 end as ccq
from frame
where channel='release' and app_name = 'Firefox' and vendor='Mozilla' and sample_id in (1,2,3,4,5,6,7,8,9,10)
and substr(subsession_start_date,0,10) >='2016-07-25' and substr(subsession_start_date,0,10) <= '2016-08-30'
and client_id is not null
group by client_id,substr(subsession_start_date,0,10)
""")
x0.registerTempTable("x0")
x1=sqlContext.sql("""
select date, cpq,ccq, count(distinct(client_id)) as n
from x0 group by date,cpq,ccq
order by date, cpq, ccq
""").collect()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment