Hive | DISTINCT on different columns not supported with skew in data

SELECT 
    count(distinct imei), 
    count(distinct imsi),
    count(distinct phone),
    count(distinct mac )  
FROM applog.xxx 
WHERE substr(dt,0,8)  = '20191227' and os = 'android'

在多个列上进行的去重操作与hive环境变量hive.groupby.skewindata存在关系。

当hive.groupby.skewindata=true时,hive不支持多列上的去重操作,因此执行以上SQL时出现异常, #如下:

DISTINCT on different columns not supported with skew in data 

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

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

 
发布了44 篇原创文章 · 获赞 11 · 访问量 5433

猜你喜欢

转载自blog.csdn.net/Sampson_Hugo/article/details/103778843