前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >2018-09-27#hive数据检查的常见方式

2018-09-27#hive数据检查的常见方式

作者头像
大数据工程师-公子
发布2019-03-14 15:58:51
4180
发布2019-03-14 15:58:51
举报

hive数据检查的常见方式

主键上的数据是否用重复

代码语言:javascript
复制
select phone_segment,count(1) as cnt
from dw.dim_phone_segment_info a
group by phone_segment
having cnt > 1;

对比去重前后的数据量

代码语言:javascript
复制
select count(1), count(distinct phone_num) from dw.dim_phone_profile a;

取每个分组中的唯一一条

代码语言:javascript
复制
drop table temp.zhjq_tmp_cc_phone;
create table temp.zhjq_tmp_cc_phone as
select
    aa.user_num,
    aa.user_province,
    aa.user_city
from(
    select
        a.user_num,
        case when length(trim(a.user_area_province)) > 0 then user_area_province else 'unknow' end user_province,
        case when length(trim(a.user_area_city)) > 0 then user_area_city else 'unknow' end user_city,
        row_number() over (partition by user_num order by time_start desc) rn
    from temp.icsoc_call_detail_bill_bill201807 a
    where length(trim(a.user_num)) > 0
) aa 
where rn = 1
;
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018年09月27日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • hive数据检查的常见方式
    • 主键上的数据是否用重复
      • 对比去重前后的数据量
        • 取每个分组中的唯一一条
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档