Sourabh Badhya created HIVE-27672:
-------------------------------------

             Summary: 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


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. Month 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_day = '2022-08-07-13'); {code}
Specifying multiple conditions is also supported - 
{code:java}
TRUNCATE TABLE tableName PARTITION (b_day = '2022-08-07-13', c_trunc = 
'xy');{code}
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 upper bound and lower bound of the existing files. If the newly 
added partition is within the upper bound and lower bound of the existing files 
then a ValidationException is thrown.



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

Reply via email to