[ 
https://issues.apache.org/jira/browse/HIVE-27672?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sourabh Badhya updated HIVE-27672:
----------------------------------
    Description: 
Support the following truncate operations on a partition level - 
{code:java}
TRUNCATE TABLE tableName PARTITION (partCol1 = partValue1, partCol2 = 
partValue2);{code}
Truncate is not supported for partition transforms.

  was:
Support the following truncate operations on a partition level - 
{code:java}
TRUNCATE TABLE tableName PARTITION (partCol1 = partValue1, partCol2 = 
partValue2);{code}
For partition transforms other than identity, the partition column must have a 
suffix to the column as follows - 
1. Truncate transform on 'b' column - b_trunc
{code:java}
TRUNCATE TABLE tableName PARTITION (b_trunc = 'xy');{code}
2. Bucket transform on 'b' column - b_bucket
{code:java}
TRUNCATE TABLE tableName PARTITION (b_bucket = 10);{code}
3. Year transform on 'b' column - b_year - The value should be in YYYY format.
{code:java}
TRUNCATE TABLE tableName PARTITION (b_year = '2022');{code}
4. Month transform on 'b' column - b_month - The value should be in YYYY-MM 
format
{code:java}
TRUNCATE TABLE tableName PARTITION (b_month = '2022-08'); {code}
5. Day transform on 'b' column - b_day - The value should be in YYYY-MM-DD 
format
{code:java}
TRUNCATE TABLE tableName PARTITION (b_day = '2022-08-07');{code}
6. Hour transform on 'b' column - b_hour - The value should be in YYYY-MM-DD-HH 
format.
{code:java}
TRUNCATE TABLE tableName PARTITION (b_hour = '2022-08-07-13'); {code}
Specifying multiple conditions is also supported - 
{code:java}
TRUNCATE TABLE tableName PARTITION (b_day = '2022-08-07', c_trunc = 'xy');{code}
The motivation for specifying the inputs in the following format is based on 
the directory structure of the data in Iceberg tables. The input reflects the 
same value that are ideally seen the data directories in Iceberg tables.

For table which has undergone partition evolution, truncate is possible for 
only identity transform and is only possible for newly added partition which 
are outside the lower bound and upper bound of the partition column of the 
existing files (files prior to partition evolution). If the newly added 
partition is within the lower bound and upper bound of the partition column of 
the existing files then performing truncate operation on the newly added 
partition throws a ValidationException.


> Iceberg: Truncate partition support
> -----------------------------------
>
>                 Key: HIVE-27672
>                 URL: https://issues.apache.org/jira/browse/HIVE-27672
>             Project: Hive
>          Issue Type: New Feature
>            Reporter: Sourabh Badhya
>            Assignee: Sourabh Badhya
>            Priority: Major
>
> Support the following truncate operations on a partition level - 
> {code:java}
> TRUNCATE TABLE tableName PARTITION (partCol1 = partValue1, partCol2 = 
> partValue2);{code}
> Truncate is not supported for partition transforms.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to