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;


insert overwrite table dwh.gdt_data partition(day='${dt_today}',category='uc_lahuo_delete',business='imei_0')
      select t2.device_id
      from
      (select device_id from dwh.gdt_data
      where day='${dt_today}' and category='uc_lahuo' and business='imei_0') t1
      right join
      (select device_id  from dwh.gdt_data
      where day='${dt_yesterday}' and category='uc_lahuo' and business='imei_0') t2
      on t1.device_id=t2.device_id
      where t1.device_id is null;

insert overwrite table dwh.gdt_data partition(day='${dt_today}',category='uc_lahuo_delete',business='imei_1')
      select t2.device_id
      from
      (select device_id from dwh.gdt_data
      where day='${dt_today}' and category='uc_lahuo' and business='imei_1') t1
      right join
      (select device_id  from dwh.gdt_data
      where day='${dt_yesterday}' and category='uc_lahuo' and business='imei_1') t2
      on t1.device_id=t2.device_id
      where t1.device_id is null;

insert overwrite table dwh.gdt_data partition(day='${dt_today}',category='uc_lahuo_delete',business='imei_2')
      select t2.device_id
      from
      (select device_id from dwh.gdt_data
      where day='${dt_today}' and category='uc_lahuo' and business='imei_2') t1
      right join
      (select device_id  from dwh.gdt_data
      where day='${dt_yesterday}' and category='uc_lahuo' and business='imei_2') t2
      on t1.device_id=t2.device_id
      where t1.device_id is null;

insert overwrite table dwh.gdt_data partition(day='${dt_today}',category='uc_lahuo_delete',business='imei_3')
      select t2.device_id
      from
      (select device_id from dwh.gdt_data
      where day='${dt_today}' and category='uc_lahuo' and business='imei_3') t1
      right join
      (select device_id  from dwh.gdt_data
      where day='${dt_yesterday}' and category='uc_lahuo' and business='imei_3') t2
      on t1.device_id=t2.device_id
      where t1.device_id is null;

insert overwrite table dwh.gdt_data partition(day='${dt_today}',category='uc_lahuo_delete',business='imei_4')
      select t2.device_id
      from
      (select device_id from dwh.gdt_data
      where day='${dt_today}' and category='uc_lahuo' and business='imei_4') t1
      right join
      (select device_id  from dwh.gdt_data
      where day='${dt_yesterday}' and category='uc_lahuo' and business='imei_4') t2
      on t1.device_id=t2.device_id
      where t1.device_id is null;

insert overwrite table dwh.gdt_data partition(day='${dt_today}',category='uc_lahuo_delete',business='imei_5')
      select t2.device_id
      from
      (select device_id from dwh.gdt_data
      where day='${dt_today}' and category='uc_lahuo' and business='imei_5') t1
      right join
      (select device_id  from dwh.gdt_data
      where day='${dt_yesterday}' and category='uc_lahuo' and business='imei_5') t2
      on t1.device_id=t2.device_id
      where t1.device_id is null;


insert overwrite table dwh.gdt_data partition(day='${dt_today}',category='uc_lahuo_delete',business='oaid_2')
      select t2.device_id
      from
      (select device_id from dwh.gdt_data
      where day='${dt_today}' and category='uc_lahuo' and business='oaid_2') t1
      right join
      (select device_id  from dwh.gdt_data
      where day='${dt_yesterday}' and category='uc_lahuo' and business='oaid_2') t2
      on t1.device_id=t2.device_id
      where t1.device_id is null;

insert overwrite table dwh.gdt_data partition(day='${dt_today}',category='uc_lahuo_delete',business='oaid_3')
      select t2.device_id
      from
      (select device_id from dwh.gdt_data
      where day='${dt_today}' and category='uc_lahuo' and business='oaid_3') t1
      right join
      (select device_id  from dwh.gdt_data
      where day='${dt_yesterday}' and category='uc_lahuo' and business='oaid_3') t2
      on t1.device_id=t2.device_id
      where t1.device_id is null;

insert overwrite table dwh.gdt_data partition(day='${dt_today}',category='uc_lahuo_delete',business='oaid_5')
      select t2.device_id
      from
      (select device_id from dwh.gdt_data
      where day='${dt_today}' and category='uc_lahuo' and business='oaid_5') t1
      right join
      (select device_id  from dwh.gdt_data
      where day='${dt_yesterday}' and category='uc_lahuo' and business='oaid_5') t2
      on t1.device_id=t2.device_id
      where t1.device_id is null;

insert overwrite table dwh.gdt_data partition(day='${dt_today}',category='uc_lahuo_delete',business='oaid_6')
      select t2.device_id
      from
      (select device_id from dwh.gdt_data
      where day='${dt_today}' and category='uc_lahuo' and business='oaid_6') t1
      right join
      (select device_id  from dwh.gdt_data
      where day='${dt_yesterday}' and category='uc_lahuo' and business='oaid_6') t2
      on t1.device_id=t2.device_id
      where t1.device_id is null;