`

set hive.groupby.skewindata与数据倾斜

    博客分类:
  • hive
阅读更多

hive和其它关系数据库一样,支持count(distinct)操作,但是对于大数据量中,如果出现数据倾斜时,会使得性能非常差,解决办法为设置数据负载均衡,其设置方法为设置hive.groupby.skewindata参数

 

hive (default)> set hive.groupby.skewindata;

hive.groupby.skewindata=false

 

默认该参数的值为false,表示不启用,要启用时,可以set hive.groupby.skewindata=ture;进行启用。

当启用时,能够解决数据倾斜的问题,但如果要在查询语句中对多个字段进行去重统计时会报错。

 

hive> set hive.groupby.skewindata=true;

hive> select count(distinct id),count(distinct x) from test;

 

FAILED: SemanticException [Error 10022]: DISTINCT on different columns not supported with skew in data

 

 

下面这种方式是可以正常查询

hive>select count(distinct id, x) from test; 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics