SteveStevenpoor opened a new issue, #16646:
URL: https://github.com/apache/iceberg/issues/16646
### Feature Request / Improvement
## Motivation
Flink already supports ```ALTER TABLE ... DROP PARTITION``` and invokes the
catalog's ```dropPartition(...)``` implementation. However, the Iceberg Flink
catalog does not currently implement this operation, leaving users without a
SQL-level mechanism to remove all data in a partition.
### How users drop a partition today
DELETE is not supported by the Iceberg Flink catalog for batch or streaming.
Users must drop into the Java/Scala Table API
(table.newDelete().deleteFromRowFilter(...).commit()) or move the operation
outside SQL entirely.
## Proposed feature
Add support for the ```ALTER TABLE … DROP PARTITION``` syntax, addressing
the partition field name, in the same human-readable form Iceberg already
writes to manifest partition paths:
```sql
ALTER TABLE events DROP PARTITION (id = 0);
ALTER TABLE events DROP PARTITION (region = 'eu', dt = '2024-01-01');
ALTER TABLE events DROP IF EXISTS PARTITION (data = 'z')
```
## Implementation sketch
- Flink: ```FlinkCatalog.dropPartition(...)``` translates the partition
specification into an Iceberg row filter and invokes
```deleteFromRowFilter(...)```
- Flink's SQL parser already accepts ```ALTER TABLE … DROP [IF EXISTS]
PARTITION (...)```.
## Safety
```deleteFromRowFilter``` already runs the strict-projection check at
commit, so partial-file deletes are rejected by Iceberg core; the new API
surface cannot silently remove rows outside the targeted partition.
### Query engine
Flink
### Willingness to contribute
- [x] I can contribute this improvement/feature independently
- [ ] I would be willing to contribute this improvement/feature with
guidance from the Iceberg community
- [ ] I cannot contribute this improvement/feature at this time
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]