select
(floor(cast(ds as bigint)/100)) as date_time,
count(DISTINCT trans_id) as n_trans
from xxx
where ds >= "20140301" and adzone_id = '10263209'
group by 1;
Begin execute SQL: select
(floor(cast(ds as bigint)/100)) as date_time,
count(DISTINCT trans_id) as n_trans
from xxx
where ds >= "20140301" and adzone_id = '10263209'
group by 1
Hive history file=/xxx.txt
FAILED: Error in semantic analysis: Line 0:-1 Expression not in GROUP BY key 'ds'
over
ds = yyyyMMdd
且date_time为yyyymm
(ds div 100和floor)。
我只是通过字段1(date_time)
进行分组,但为什么编译说它应该按照' ds'?
编辑:
ds
是分区的字段。
答案 0 :(得分:0)
Hive group by可以在原始列数据上完成