ASP源码.NET源码PHP源码JSP源码JAVA源码DELPHI源码PB源码VC源码VB源码Android源码
当前位置:首页 >> 数据库 >> SqlServer >> hive count distinct

hive count distinct

来源:网络整理     时间:2015-07-28     关键词:

本篇文章主要介绍了"hive count distinct",主要涉及到方面的内容,对于SqlServer感兴趣的同学可以参考一下: select count(distinct user_id) from dm_user where ds=20150701;使用disticnt函数,所有的数据...

select count(distinct user_id) from dm_user where ds=20150701;

使用disticnt函数,所有的数据只会shuffle到一个reducer上,导致reducer数据倾斜严重

优化后为

set mapred.reduce.tasks=50;

select count(*) from

(select user_id from dm_user where ds=20150701 group by user_id)t;

order by全局排序,只有一个reduce

sort by 在一个reduce中排序,distribute by 按字段分为不同的reduce    

distribute by 先分为不同的reduce排序,之后在reduce内部排序

版权声明:本文为博主原创文章,未经博主允许不得转载。

以上就介绍了hive count distinct,包括了方面的内容,希望对SqlServer有兴趣的朋友有所帮助。

本文网址链接:http://www.codes51.com/article/detail_154352.html

相关图片

相关文章