lateral view 结合 explode 可以实现将 一行转化为行的功能
INSERT OVERWRITE TABLE ${eventAtributesTable} PARTITION (hp_stat_date = '$date')
SELECT page_attributes.atime/1000, page_attributes.page_id, page_attributes.username,
page_attributes.account, page_attributes.action, page_attributes.category, page_attributes.plat, page_attributes.domain,
page_attributes.ralg, page_attributes.uniqueKey, item,
from_unixtime(page_attributes.atime/1000, 'YYYY-MM-dd')
FROM log
lateral view explode(page_attributes.item) log as item
WHERE abnormal_flag = false and (page_attributes.action = "expose" or action == "click")
具体可参考:
http://www.cnblogs.com/ggjucheng/archive/2013/01/03/2842938.html
网友评论