hql 查找非group by字段

1.取得非group by 字段
 select COLLECT_LIST(event) , uuid from stat_event group by uuid;
 
2.得到事件流(自定义事件处理)
select cid, uuid, account, concat_ws(',', COLLECT_LIST(cast (event AS string) ) ), concat_ws(',', COLLECT_LIST(cast (timestamp AS string) ) ) from stat_event where year = 2015 and month = 1 and day = 5 group by cid, uuid, account;
 
总结:
COLLECT_LIST(event):会得到一个 完整的 事件序列(未排序的)
COLLECT_SET(event):会得到一个  去重的 事件序列 (未排序的)
concat_ws(',' ,  COLLECT_LIST(cast (event AS string) ) )  :事件按照逗号分隔,组成一个事件流字符串

你可能感兴趣的:(HQL,hive,group by)