USE dwh;
CREATE EXTERNAL TABLE dwh.`dmp_interest_tag`(
    device_id string,
    device_type string,
    platform string,
    tags string
)PARTITIONED BY (
    dt string
) ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
STORED AS INPUTFORMAT
    'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT
    'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
LOCATION 's3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/dmp_interest_tag';

alter table dwh.dmp_interest_tag add columns(ext_data string,update_date string default '');

CREATE EXTERNAL TABLE dwh.device_id_md5_match(
    device_id string,
    device_id_md5 string,
    device_type string
) PARTITIONED BY (
    dt string
) ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
STORED AS INPUTFORMAT
    'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT
    'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
LOCATION 'ss3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/device_id_md5_match';
-- ALTER TABLE dwh.device_id_md5_match ADD PARTITION(dt = '20201215', device_type = 'androidid') LOCATION 's3://mob-emr-test/dataplatform/DataWareHouse/dwh.db/device_id_md5_match/dt=20201214/device_type=androidid';
-- ALTER TABLE dwh.device_id_md5_match ADD PARTITION(dt = '20201215', device_type = 'gaid') LOCATION 's3://mob-emr-test/dataplatform/DataWareHouse/dwh.db/device_id_md5_match/dt=20201214/device_type=gaid';
-- ALTER TABLE dwh.device_id_md5_match ADD PARTITION(dt = '20201215', device_type = 'idfa') LOCATION 's3://mob-emr-test/dataplatform/DataWareHouse/dwh.db/device_id_md5_match/dt=20201214/device_type=idfa';
-- ALTER TABLE dwh.device_id_md5_match ADD PARTITION(dt = '20201215', device_type = 'imei') LOCATION 's3://mob-emr-test/dataplatform/DataWareHouse/dwh.db/device_id_md5_match/dt=20201214/device_type=imei';
-- ALTER TABLE dwh.device_id_md5_match ADD PARTITION(dt = '20201215', device_type = 'imeimd5') LOCATION 's3://mob-emr-test/dataplatform/DataWareHouse/dwh.db/device_id_md5_match/dt=20201214/device_type=imeimd5';
-- ALTER TABLE dwh.device_id_md5_match ADD PARTITION(dt = '20201215', device_type = 'oaid') LOCATION 's3://mob-emr-test/dataplatform/DataWareHouse/dwh.db/device_id_md5_match/dt=20201214/device_type=oaid';
-- ALTER TABLE dwh.device_id_md5_match ADD PARTITION(dt = '20201215', device_type = 'sysid') LOCATION 's3://mob-emr-test/dataplatform/DataWareHouse/dwh.db/device_id_md5_match/dt=20201214/device_type=sysid';
-- ALTER TABLE dwh.device_id_md5_match ADD PARTITION(dt = '20201215', device_type = 'upid') LOCATION 's3://mob-emr-test/dataplatform/DataWareHouse/dwh.db/device_id_md5_match/dt=20201214/device_type=upid';