ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

埋点-App层丢失率

2021-08-26 15:32:45  阅读:203  来源: 互联网

标签:-- App label version biz 丢失 video 埋点 dt


一、建表语句

create table dws_bhv_habo_measure_lostrate_mb_di(
  version_flag bigint comment '版本标签  2:web丢失  3ios直播丢失  4安卓直播丢失',
  query_version string comment '查询版本号',
  is_video int comment '直播标签 1直播 0非直播',
  sumcount bigint comment '总数',
  actual_count bigint comment '实际上报数',
  lost_rate string comment '丢失率')
partitioned by ( dt int comment '分区')

二、模型代码

set hive.exec.dynamic.partition.mode = nonstrict;
insert overwrite table taeget_tab partition(dt)

select
  version_flag,
  query_version,
  is_video,
  sum(should) as sumcount,
  sum(actual) as actual_count,
  1 - sum(actual) * 1.00 / sum(should) as lost_rate,
  dt
from(
    select
      dt,
      did,
      biz_type,
      biz_name,
      query_version,
      version_flag,
      is_video,
      (max(req_idx) - min(req_idx) + 1) as should, --应该
      count(distinct req_idx) as actual --实际
    from(
        --对各个客户端条件打标签
        select
        dt
        ,did
        ,req_idx
        ,is_video
        ,biz_type
        ,biz_name
        --统一Web和App的字段
        ,IF(label_map['label_loss_02']='1'
            ,sdk_version,app_version) query_version
        ,case
            when label_map['label_loss_03']='1' then 3       --ios直播丢失率条件
            when label_map['label_loss_04']='1' then 4       --android直播丢失率条件
            when label_map['label_loss_02']='1' then 2       --web丢失率条件
            else -1
        end as version_flag
        from(
            select
            dt,
            event_time,
            video_time,
            did,
            gif,
            sdk_version,
            app_version,
            biz_type,
            biz_name,
            client_type,
            is_video,
            label_map,
            req_idx
            from
            base_table
            where
            dt = ${dt}
            and client_type not in(-1,8, 9)
            and biz_type = 7
        )base_tab
    ) label_tab
    group by
      dt,
      biz_type,
      biz_name,
      query_version,
      did,
      version_flag,
      is_video
) out_tab
group by
  dt,
  version_flag,
  query_version,
  is_video

 

标签:--,App,label,version,biz,丢失,video,埋点,dt
来源: https://www.cnblogs.com/robots2/p/15189819.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有