Hive动态分区

示例(dynamic partition):
建表
hive>  CREATE TABLE IF NOT EXISTS T_tmp (
 LogId bigint  ,
 UserId bigint ,
 actionDay string)
 ROW FORMAT DELIMITED FIELDS TERMINATED BY '\;'  ;
OK
Time taken: 0.393 seconds


 CREATE TABLE IF NOT EXISTS T (
 LogId bigint  ,
 UserId bigint  COMMENT '用户ID' )
 PARTITIONED BY (actionDay string)
 ROW FORMAT DELIMITED FIELDS TERMINATED BY '\;'  ;




设置参数
hive> set hive.exec.dynamic.partition.mode=nonstrict; 
hive> set hive.exec.dynamic.partition=true;


导入数据:

hive> insert overwrite table t partition(actionday) select logid, userid, actionday from t_tmp where actionday='20140723';


你可能感兴趣的:(Hive动态分区)