|SELECT '${stat_date}' as stat_date,sum(a.time_all)/count(a.device_id) as device_duration_avge,count(distinct(a.device_id)) as device_num from (select device_id,sum(params['duration']) as time_all
|select '${stat_date}' as stat_date,count(DISTINCT(device_id))
|from bl.bl_alpha_et_mg_maidianlog_inc_d
|from ML_ALPHA_C_CT_DV_DEVICE_DIMEN_D
|where type='on_app_session_over'
|where partition_day='${partition_date}'
|and partition_day='${partition_date}'
|and is_today_active="1"
|GROUP BY device_id) a
""".stripMargin
""".stripMargin
)
)
device_duration_avge.show()
device_num_count.show()
valduration_everytime_avge=sc.sql(
valduration_device=sc.sql(
s"""
s"""
|SELECT '${stat_date}' as stat_date,sum(a.time_duration)/count(a.device_id) as duration_everytime_avge from (select device_id,params['duration'] as time_duration
|select '${stat_date}' as stat_date,sum(user_duration)/count(DISTINCT(device_id))