一般去这里寻找UDF,下面为列举的相关转换,(河北电信依照新的协议上传数据所需)
ip:iptostring(userip)
节目:dimcache('movie',dim_movie_mid)
节目类型:dimcache('moviegenre',dim_movie_category)
开始时间:from_unixtime(metric_playbgntime)
结束时间:from_unixtime(metric_playbgntime+metric_durationtime)
播放时长:metric_durationtime
下面是两个hive后台执行命令(hive存储过程中的任务)
2016.9.2河北电信原来的全部点播数据传送
INSERT OVERWRITE LOCAL DIRECTORY "/opt/dataftp/@yesterday"row format delimited fields terminated by '|' select * from fact_vod_historywhere dim_oem_id in (824,300138,300194,30025) and day=@yesterday;
2016.9.2河北电信更改后按照协议传送的点播数据
INSERT OVERWRITE LOCAL DIRECTORY "/opt/dataftp/@yesterday"row format delimited fields terminated by '|' select iptostring
(userip),dim_user_uid,dim_oem_id,dim_user_hid,dimcache('movie',dim_movie_mid),dim_media_series,dimcache('movietype',dim_movie_category),from_unixtime(metric_playbgntime),
from_unixtime(metric_playbgntime+metric_durationtime),metric_durationtime,if
(metric_ispaymovie=0,'收费','免费') from fact_vod_history where dim_oem_id in(824,300138,300194,30025) and day=@yesterday;