【Hive & Spark】修复分区
语法
MSCK REPAIR TABLE table_identifier [{ADD|DROP|SYNC} PARTITIONS]
msck repair table table_identifier 默认执行的是 add partitions操作
Syntax
MSCK REPAIR TABLE table_identifier [{ADD|DROP|SYNC} PARTITIONS]
Parameters
table_identifier
Specifies the name of the table to be repaired. The table name may be optionally qualified with a database name.
Syntax: [ database_name. ] table_name
{ADD|DROP|SYNC} PARTITIONS
Specifies how to recover partitions. If not specified, ADD is the default.
ADD, the command adds new partitions to the session catalog for all sub-folder in the base table folder that don’t belong to any table partitions.
DROP, the command drops all partitions from the session catalog that have non-existing locations in the file system.
SYNC is the combination of DROP and ADD.