Python全系列 教程
3567个小节阅读:5925k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL
(表已创建,在此基础上添加分区,注意只能添加在表创建时定义好的分区的值)
语法格式:
xxxxxxxxxx
alter table table_name add [if not exists] partition partition_spec [location 'location'][, partition partition_spec [location 'location'], ...];
partition_spec:
: (partition_column = partition_col_value, partition_column = partition_col_value, ...)
例:
xxxxxxxxxx
hive> alter table person5 add partition(age=30);
OK
Time taken: 3.903 seconds
hive> alter table person6 add partition(age=40);
FAILED: ValidationFailureSemanticException default.person6: partition spec {age=40} doesn't contain all (2) partition columns
hive> alter table person6 add partition(age=40,sex='man');
OK
Time taken: 0.352 seconds
单分区的表添加分区时指定一个分区,可以直接添加。
表在创建时定义的时双分区,条件分区值时,不能只指定一个,需要同时指定两个分区的值。
xxxxxxxxxx
hive> alter table person6 add partition(age=40,sex='man');
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. AlreadyExistsException(message:Partition already exists: Partition(values:[40, man]......
只建目录没有数据。如果添加的分区已经存在,则抛出AlreadyExistsException。