- 分区表结构如下
CREATE EXTERNAL TABLE (
name STRING
)
PARTITIONED BY (sex string,age int)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '|'
location '/hive/warehouse/ccdb1.db/student' - 表建立后新增分区
alter table student add IF NOT EXISTS partition(sex='男',age='30')
alter table student add IF NOT EXISTS partition(sex='女',age='32')
以上两个脚本执行没问题
3.现在我想再新增一个性别是男,年龄是32的新分区
alter table student add IF NOT EXISTS partition(sex='男',age='32')
hive (ccdb1)> alter table student add IF NOT EXISTS partition(sex='男',age='32');
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:Expecting a partition with name sex=男/age=32, but metastore is returning a partition with name sex=?/age=32.)