TOP

hive中group by 提示Expression Not In Group By Key的解决办法
2018-11-26 17:05:18 】 浏览:1041
Tags:hive group 提示 Expression Not Group Key 解决 办法

版权声明:本文为博主原创文章,欢迎诸位分享交流 https://blog.csdn.net/xiaoshunzi111/article/details/48781675

一 hive中group by 提示Expression Not In Group By Key

如图:




二 异常原因:

hive中group by的时候

hive> select count(market) province ,market from market_table ;

会提示:

FAILED: SemanticException [Error 10025]: Line 1:12 Expression not in GROUP BY key ‘market′


三 解决方案(两种):

1、不关心‘market 的值,且有多个province,那么语句改成

select market, collect_set( province )[0] from table_name group by market;
collect_set( province )[0] from table_name group by market ;

2、如果每个province 的值不同且关心province 的值,那么可以改成

hive> select count(market) province ,market from market_tablegroup by province,market;


详情参见:http://one-line-it.blogspot.com/2012/11/hive-expression-not-in-group-by-key.html


hive中group by 提示Expression Not In Group By Key的解决办法 https://www.cppentry.com/bencandy.php?fid=117&id=186238

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇cloudera mamager中配置hive加载.. 下一篇Exception in thread "main&..