Altering the Partition Location of a Table (Only OBS Tables Supported)
Function
This statement is used to modify the positions of table partitions.
Syntax
1 2 3 | ALTER TABLE table_name
PARTITION partition_specs
SET LOCATION obs_path;
|
Keyword
None
Precautions
- For a table partition whose position is to be modified, the table and partition must exist. Otherwise, an error is reported.
- By default, the partition_specs parameter contains (). For example: PARTITION (dt='2009-09-09',city='Shanghai')
- The specified OBS path must be an absolute path. Otherwise, an error is reported.
- If the path specified in the new partition contains subdirectories (or nested subdirectories), all file types and content in the subdirectories are considered partition records. Ensure that all file types and file content in the partition directory are the same as those in the table. Otherwise, an error is reported.
Example
To set the OBS path of partition dt='2008-08-08',city='Hangzhou' in table student to obs://bucketName/fileName/student/dt=2008-08-08/city=Hangzhou_bk, run the following statement:
1 2 3 | ALTER TABLE student
PARTITION(dt='2008-08-08',city='Hangzhou')
SET LOCATION 'obs://bucketName/fileName/student/dt=2008-08-08/city=Hangzhou_bk';
|
Last Article: Deleting a Partition
Next Article: Modifying the SerDe Attribute of a Table Partition (Only OBS Tables Supported)
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.