Hive 使用配置单元在组中出错
我正在使用下面的代码并得到下面的错误Hive 使用配置单元在组中出错,hive,Hive,我正在使用下面的代码并得到下面的错误 select d.searchpack,d.context, d.day,d,txnid,d.config, c.sgtype from ds3resultstats d join context_header c on (d.context=c.contextid) where (d.day>='2012-11-15' and d.day<='2012-11-25' and c.sgtype='Tickle
select d.searchpack,d.context, d.day,d,txnid,d.config, c.sgtype from ds3resultstats d join
context_header c on (d.context=c.contextid) where (d.day>='2012-11-15' and d.day<='2012-11-25' and c.sgtype='Tickler' and d.config like
'%people%') GROUP BY d.context limit 10;
FAILED: Error in semantic analysis: line 1:7 Expression Not In Group By Key d
从ds3resultstats d join中选择d.searchpack、d.context、d.day、d、txnid、d.config、c.sgtype
context_头c on(d.context=c.contextid),其中(d.day>='2012-11-15'和d.day当您使用分组依据时,您不能选择其他附加字段。您只能使用聚合功能选择分组键
有关更多信息,请参阅
代码示例:
select d.context,count(*)
from ds3resultstats
...
group by d.context
或按乘法字段分组
select d.context, d.field2, count(*)
from ds3resultstats
...
group by d.context, d.field2
它希望所有列都添加group by。
即使是我也面临着同样的问题,但我还是设法解决了这类问题。
您可以对列名使用collect\u set
,以获取输出
选择d.searchpack,按d.searchpack从样本组中收集集合(d.context);