Skip to content
Permalink
Browse files
[CARBONDATA-4327] Update documentation related to partition
Why is this PR needed?
Drop partition with data is not supported and a few of the links are not working.

What changes were proposed in this PR?
Removed unsupported syntax , duplicate headings and updated the header with proper linkage.

This closes #4254
  • Loading branch information
ShreelekhyaG authored and kunal642 committed Mar 18, 2022
1 parent a838531 commit 41831cefa60d9df8f33f1603531b18b8def1b8fa
Showing 1 changed file with 16 additions and 47 deletions.
@@ -60,12 +60,11 @@ CarbonData DDL statements are documented here,which includes:
* [REFRESH TABLE](#refresh-table)
* [COMMENTS](#table-and-column-comment)
* [PARTITION](#partition)
* [STANDARD PARTITION(HIVE)](#standard-partition)
* [INSERT OVERWRITE PARTITION](#insert-overwrite)
* [CREATE PARTITION](#create-partition-table)
* [SHOW PARTITIONS](#show-partitions)
* [ADD PARTITION](#add-a-new-partition)
* [SPLIT PARTITION](#split-a-partition)
* [DROP PARTITION](#drop-a-partition)
* [ADD PARTITION](#add-partition)
* [DROP PARTITION](#drop-partition)
* [INSERT OVERWRITE PARTITION](#insert-overwrite)
* [BUCKETING](#bucketing)
* [CACHE](#cache)

@@ -1085,9 +1084,20 @@ Users can specify which columns to include and exclude for local dictionary gene
SHOW PARTITIONS [db_name.]table_name
```
### Add Partition
This command adds the specified Hive partition.
```
ALTER TABLE [db_name].table_name ADD PARTITION(part_spec, ...)
```
Example:
```
ALTER TABLE locationTable ADD PARTITION (country = 'US');
```
#### Drop Partition
This command drops the specified Hive partition only.
This command drops the specified Hive partition.
```
ALTER TABLE table_name DROP [IF EXISTS] PARTITION (part_spec, ...)
```
@@ -1115,47 +1125,6 @@ Users can specify which columns to include and exclude for local dictionary gene
WHERE au.country = 'US';
```
### Show Partitions
The following command is executed to get the partition information of the table
```
SHOW PARTITIONS [db_name.]table_name
```
### Add a new partition
```
ALTER TABLE [db_name].table_name ADD PARTITION('new_partition')
```
### Drop a partition
Only drop partition definition, but keep data
```
ALTER TABLE [db_name].table_name DROP PARTITION(partition_id)
```
Drop both partition definition and data
```
ALTER TABLE [db_name].table_name DROP PARTITION(partition_id) WITH DATA
```
**NOTE:**
* Hash partition table is not supported for ADD, SPLIT and DROP commands.
* Partition Id: in CarbonData like the hive, folders are not used to divide partitions instead partition id is used to replace the task id. It could make use of the characteristic and meanwhile reduce some metadata.
```
SegmentDir/0_batchno0-0-1502703086921.carbonindex
^
SegmentDir/part-0-0_batchno0-0-1502703086921.carbondata
^
```
Here are some useful tips to improve query performance of carbonData partition table:
* The partitioned column can be excluded from SORT_COLUMNS, this will let other columns to do the efficient sorting.
* When writing SQL on a partition table, try to use filters on the partition column.
## BUCKETING
Bucketing feature can be used to distribute/organize the table/partition data into multiple files such

0 comments on commit 41831ce

Please sign in to comment.