select u.video_id, round((sum(if(user_duration>=duration,1,0))/count(u.video_id)),3) as avg_comp_play_rate from ( select video_id, (unix_timestamp(end_time) - unix_timestamp(start_time)) as user_duration from tb_user_video_log -- where date_format(start_time,'yyyy') = '2021' //hive where year(sta...