set  hive.exec.dynamic.partition.mode=nonstrict;
set  hive.exec.dynamic.partition=true;
set mapred.max.split.size=536870912;
set mapred.min.split.size.per.node=536870912;
set mapred.min.split.size.per.rack=536870912;
set mapreduce.map.memory.mb=4000;
set mapreduce.map.java.opts=-Xmx3000m;
set mapreduce.reduce.memory.mb=3072;
set mapreduce.reduce.java.opts=-Xmx2458m;
set hive.jobname.length=100;


insert into table dwh.dm_install_list_v2 partition(dt='${dt_today}',business='ali_activation')
     select device_id,'imei' device_type,'android' platform,'com.taobao.foractivation.204543_oppo' package_name,'${update_date}' update_date
     from dwh.dm_install_list_v2_tmp_deviceid where dt='${dt_today}' and device_type='204543_imei'
     UNION
     select device_id,'imeimd5' device_type,'android' platform,'com.taobao.foractivation.204543_oppo' package_name,'${update_date}' update_date
     from dwh.dm_install_list_v2_tmp_deviceid where dt='${dt_today}' and device_type='204543_imeimd5';

insert into table dwh.dm_install_list_v2 partition(dt='${dt_today}',business='ali_activation')
     select device_id,'imei' device_type,'android' platform,'com.taobao.foractivation.227229_oppo' package_name,'${update_date}' update_date
     from dwh.dm_install_list_v2_tmp_deviceid where dt='${dt_today}' and device_type='227229_imei'
     UNION
     select device_id,'imeimd5' device_type,'android' platform,'com.taobao.foractivation.227229_oppo' package_name,'${update_date}' update_date
     from dwh.dm_install_list_v2_tmp_deviceid where dt='${dt_today}' and device_type='227229_imeimd5';

insert into table dwh.dm_install_list_v2 partition(dt='${dt_today}',business='ali_activation')
     select device_id,'imei' device_type,'android' platform,'com.taobao.foractivation.188844_oppo' package_name,'${update_date}' update_date
     from dwh.dm_install_list_v2_tmp_deviceid where dt='${dt_today}' and device_type='188844_imei'
     UNION
     select device_id,'imeimd5' device_type,'android' platform,'com.taobao.foractivation.188844_oppo' package_name,'${update_date}' update_date
     from dwh.dm_install_list_v2_tmp_deviceid where dt='${dt_today}' and device_type='188844_imeimd5';


insert into table dwh.dm_install_list_v2 partition(dt='${dt_today}',business='ali_activation')
     select device_id,'imeimd5' device_type,'android' platform,'com.taobao.foractivation.iqyi_227229' package_name,'${update_date}' update_date
     from dwh.dm_install_list_v2_tmp_deviceid where dt='${dt_today}' and device_type='iqyi_227229_imeimd5'
     UNION
     select device_id,'oaidmd5' device_type,'android' platform,'com.taobao.foractivation.iqyi_227229_oaid' package_name,'${update_date}' update_date
     from dwh.dm_install_list_v2_tmp_deviceid where dt='${dt_today}' and device_type='iqyi_227229_oaidmd5';


insert into table dwh.dm_install_list_v2 partition(dt='${dt_today}',business='ali_activation')
     select device_id,device_type,platform,'com.taobao.taobao_btop' package_name,'${update_date}' update_date
     from dwh.dm_install_list_v2
     where dt='${dt_one_day_ago}' and business='btop'  and package_name='com.taobao.taobao' and device_type='imei' and  update_date='${dt_one_day_dash_ago}';