https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Types
drop table appuserprofile ;
CREATE EXTERNAL TABLE `appuserprofile`(
`mark` string,
`appkey` string,
`idfa` string,
`imei` string,
`androidid` string,
`mac` string,
`active_timestamp` bigint,
`active_hour` int,
`tbl_start_timestamp` bigint,
`tbl_start_hour` int,
`last_start_timestamp` bigint,
`last_start_hour` int,
`total_start_num` int,
`current_day_start_num` int,
`history_start_days_num` int,
`total_visit_app_time` int,
`is_update_appversion` int,
`appversion` string,
`channelid` string,
`countryid` string,
`provinceid` string,
`cityid` string,
`devicetype` string,
`screen` string,
`osversion` string,
`sp` string,
`network` string,
`brand` string,
`insert_timestamp` bigint,
`events` ARRAY<STRING>,
`current_hour_start_num` int
)
PARTITIONED BY (
`dt` string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
COLLECTION ITEMS TERMINATED BY ','
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.SequenceFileInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat'
LOCATION
'hdfs://SHYF-H11-BH03:52310/bh/warehouse/mobile_tracking'
TBLPROPERTIES (
'transient_lastDdlTime'='1439198366');
alter table appuserprofile add if not exists partition (dt='2016042700') location '/bh/warehouse/mobile_tracking/AppUserProfileAddDurationJob/2016042700';
select events from appuserprofile where size( events) >1 limit 10;
hive -e "alter table appuserprofile add if not exists partition (dt='2016042600') location '/bh/warehouse/mobile_tracking/AppUserProfileAddDurationJob/2016042600’";