在hue中,使用impala查询时, distinct host 查出结果为 2089, 而使用count(distinct host) 查出结果为2034;
通过查看DISTINCT Operator, 看到 “开启自动将COUNT(DISTINCT)重写为NDV(),通过加上查询参数APPX_COUNT_DISTINCT”
在hue里,使用NDV(host) 查出结果为2034, 可知HUE连接impala时自动加上了APPX_COUNT_DISTINCT, 使count(distinct host) 转为NDV(host) , 而NDV是快速得到近似值;
而直接在impala shell里执行,得到的结果是正确的;
在hue和impala-shell里通过 set查看查询参数:
> set;
APPX_COUNT_DISTINCT: [0]
这个参数并没有开启;
第二天在Hue查询,结果又是正常的了;进一步查找原因
使用在hue里explain查看查询任务
> explain select count(distinct host) from default.tmp_kn2_monitor_host_runhigh_hour_4_2019102310
WARNING: The following tables are missing relevant table and/or column statistics
可能跟表统计有关;也可能跟节点信息不同步有关;
在Hue中使用Impala查询时,发现distinct host与count(distinct host)结果不一致,深入分析发现Hue自动将后者转换为NDV(),导致结果偏差。本文探讨了这一现象的原因及解决方案。
1615

被折叠的 条评论
为什么被折叠?



