hive> create table mp (a string) partitioned by (b string, c string);
OK
Timetaken:0.044seconds
hive>altertablempaddpartition(b='1',c='1');
OK
Timetaken:0.079seconds
hive>altertablempaddpartition(b='1',c='2');
OK
Timetaken:0.052seconds
hive>altertablempaddpartition(b='2',c='2');
OK
Timetaken:0.056seconds
hive>showpartitionsmp;
OK
b=1/c=1
b=1/c=2
b=2/c=2
Timetaken:0.046seconds
hive>explainextendedaltertablempdroppartition(b='1');
OK
ABSTRACTSYNTAXTREE:
(TOK_ALTERTABLE_DROPPARTSmp(TOK_PARTSPEC(TOK_PARTVALb'1')))
STAGEDEPENDENCIES:
Stage-0isarootstage
STAGEPLANS:
Stage:Stage-0
DropTableOperator:
DropTable
table:mp
Timetaken:0.048seconds
hive>altertablempdroppartition(b='1');
FAILED:Errorinmetadata:tableispartitionedbutpartitionspecisnotspecifiedortab:{b=1}
FAILED:ExecutionError,returncode1fromorg.apache.hadoop.hive.ql.exec.DDLTask
hive>showpartitionsmp;
OK
b=1/c=1
b=1/c=2
b=2/c=2
Timetaken:0.044seconds
hive>altertablempaddpartition(b='1',c='3')partition(b='1',c='4');
OK
Timetaken:0.168seconds
hive>showpartitionsmp;
OK
b=1/c=1
b=1/c=2
b=1/c=3
b=1/c=4
b=2/c=2
b=2/c=3
Timetaken:0.066seconds
hive>insertoverwritetablemppartition(b='1',c='1')selectcntfromtmp_et3;
hive>alter table mp add columns (newcol string);location指定目录结构 hive>altertablealter2addpartition(insertdate='2008-01-01')location'2008/01/01'; hive>altertablealter2addpartition(insertdate='2008-01-02')location'2008/01/02'; |