CREATE External TABLE profile (
userId int
)
PARTITIONED BY (city String)
location '/user/test/profile';
set hive.exec.dynamic.partition.mode=nonstrict;
hive> insert into profile partition(city)
select * from nonpartition;
hive> select * from profile;
OK
1 Chicago
1 Chicago
2 Orlando
2条答案
按热度按时间tvz2xvvm1#
恢复分区(msck修复表)
https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#languagemanualddl-恢复分区(msckrepairtable)
分区将自动添加
u5i3ibmn2#
使用动态分区,不需要手动创建目录。但是动态分区模式需要设置为nonstrict,默认情况下是strict
在hdfs中