Hive Partition 操作

create external table demo (userid int ,name string ,address string)
comment 'demo'
partitioned by (txdate string ,txhour string)
row format delimited fields terminated by '	'
lines terminated by '
' stored as parquet    //parquet 是采用列式存储的 sorted as textfile

如果创建的table 是 parquet 模式 那么 loclation 的 数据也需要时parquet 的 否则 就又问题了

增加partition 
alter table table_name add partition (name 1 = 1 ,name 2 = 3 ) location '///' 在已经存在的table 增加分区,跟db2 一样 事先增加分区
此处的location 不是必须的 ,但是想创建分区的时候 同时导入数据这么加上location 是没有问题的 

load data local inpath '' into  table table_name partition() 



原文地址:https://www.cnblogs.com/TendToBigData/p/10501270.html