码迷,mamicode.com
首页 > 其他好文 > 详细

在Hive中遇到的错误

时间:2017-03-05 12:29:38      阅读:2670      评论:0      收藏:0      [点我收藏+]

标签:count   sel   sql   ext   res   rom   exception   fail   访问   

与其说是hive的错误,其实也感觉是自己的sql语句的基础不扎实。导致了下面的错误:

FAILED: SemanticException [Error 10025]: Line 1:7 Expression not in GROUP BY key ‘country’

在 hive 里为了查询 country的IP访问数量,创建了count_ip表

create table count_ip AS

select country,count(country)as country_ip_count

from weblog_entries,ip_to_country

where weblog_entries.ip=ip_to_country.ip

group by weblog_entries.ip;

反复的查询下,一直报同样的 Expression not in GROUP BY key 错误,仔细查看之后才发现其实是group by 语句用法出现了问题, 导致表达式出现问题,略微修改之后

create table count_ip AS

select country,count(weblog_entries.ip)as country_ip_count

from weblog_entries,ip_to_country

where weblog_entries.ip=ip_to_country.ip

group by country;

就能成功查询到 country 的 IP 计数

在Hive中遇到的错误

标签:count   sel   sql   ext   res   rom   exception   fail   访问   

原文地址:http://www.cnblogs.com/leo233/p/6504717.html

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!