hive 建立表结构 ,添加分区


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’";


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值