[
https://issues.apache.org/jira/browse/HIVE-28762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ayush Saxena updated HIVE-28762:
--------------------------------
Description:
If a partition column has some transform, drop partition doesn't do anything
{noformat}
CREATE TABLE drop_partition (
sensor_id STRING,
location_id STRING,
reading_time TIMESTAMP,
temperature DOUBLE,
humidity DOUBLE
)
PARTITIONED BY SPEC (location_id, days(reading_time))
STORED BY ICEBERG
TBLPROPERTIES (
'write.format.default'='parquet',
'format-version'='2',
'write.parquet.compression-codec'='gzip'
);
INSERT INTO drop_partition VALUES
('sensor_001', 'loc_001', '2024-06-01 10:00:00', 22.5, 60.0),
('sensor_002', 'loc_002', '2024-06-01 10:15:00', 23.0, 58.0),
('sensor_001', 'loc_001', '2024-06-02 11:00:00', 22.8, 61.0);
ALTER TABLE drop_partition DROP PARTITION (location_id = 'loc_002',
day(reading_time) = '2024-06-01');
SELECT * FROM drop_partition;
Expected output:
sensor_001,loc_001,2024-06-01 10:00:00,22.5,60.0
sensor_001,loc_001,2024-06-02 11:00:00,22.8,61.0
{noformat}
was:
If a partition column has some transform, drop partition doesn't do anything
{noformat}
CREATE TABLE drop_partition (
sensor_id STRING,
location_id STRING,
reading_time TIMESTAMP,
temperature DOUBLE,
humidity DOUBLE
)
PARTITIONED BY SPEC (location_id, days(reading_time))
STORED BY ICEBERG
TBLPROPERTIES (
'write.format.default'='parquet',
'format-version'='2',
'write.parquet.compression-codec'='gzip'
);
INSERT INTO drop_partition VALUES
('sensor_001', 'loc_001', '2024-06-01 10:00:00', 22.5, 60.0),
('sensor_002', 'loc_002', '2024-06-01 10:15:00', 23.0, 58.0),
('sensor_001', 'loc_001', '2024-06-02 11:00:00', 22.8, 61.0);
ALTER TABLE drop_partition DROP PARTITION (location_id = 'loc_002',
reading_time = '2024-06-01 10:15:00');
SELECT * FROM drop_partition;
Expected output:
sensor_001,loc_001,2024-06-01 10:00:00,22.5,60.0
sensor_001,loc_001,2024-06-02 11:00:00,22.8,61.0
Actual output:
sensor_001,loc_001,2024-06-01 10:00:00,22.5,60.0
sensor_001,loc_001,2024-06-02 11:00:00,22.8,61.0
sensor_002,loc_002,2024-06-01 10:15:00,23.0,58.0 ==> this row is not deleted.
{noformat}
> Iceberg: Add support for partitions with transforms in Drop partition
> ---------------------------------------------------------------------
>
> Key: HIVE-28762
> URL: https://issues.apache.org/jira/browse/HIVE-28762
> Project: Hive
> Issue Type: Improvement
> Reporter: Ayush Saxena
> Assignee: Ayush Saxena
> Priority: Major
>
> If a partition column has some transform, drop partition doesn't do anything
> {noformat}
> CREATE TABLE drop_partition (
> sensor_id STRING,
> location_id STRING,
> reading_time TIMESTAMP,
> temperature DOUBLE,
> humidity DOUBLE
> )
> PARTITIONED BY SPEC (location_id, days(reading_time))
> STORED BY ICEBERG
> TBLPROPERTIES (
> 'write.format.default'='parquet',
> 'format-version'='2',
> 'write.parquet.compression-codec'='gzip'
> );
> INSERT INTO drop_partition VALUES
> ('sensor_001', 'loc_001', '2024-06-01 10:00:00', 22.5, 60.0),
> ('sensor_002', 'loc_002', '2024-06-01 10:15:00', 23.0, 58.0),
> ('sensor_001', 'loc_001', '2024-06-02 11:00:00', 22.8, 61.0);
> ALTER TABLE drop_partition DROP PARTITION (location_id = 'loc_002',
> day(reading_time) = '2024-06-01');
> SELECT * FROM drop_partition;
> Expected output:
> sensor_001,loc_001,2024-06-01 10:00:00,22.5,60.0
> sensor_001,loc_001,2024-06-02 11:00:00,22.8,61.0
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)