mithilgirish opened a new pull request, #1104:
URL: https://github.com/apache/iceberg-go/pull/1104

   Fixes #1092
   
   ## Summary
   Adds `PurgeableTable` as an optional interface so catalogs can support
   physical deletion of table files when dropping a table.
   
   Today, `DropTable` only removes the catalog metadata entry — physical
   files (Parquet, manifests, metadata JSON) remain on storage. This PR
   closes that gap for client-side catalogs without making any breaking
   changes to the `Catalog.DropTable` signature.
   
   ## Changes
   
   ### Core
   - `catalog/catalog.go` — add `PurgeableTable` optional interface
   - `catalog/internal/utils.go` — add `PurgeTableFiles` shared helper
     using `WalkDir` + `BulkRemovableIO` fallback for storage-agnostic deletion
   
   ### Per-catalog
   - **SQL**: load table metadata, drop catalog entry, walk and delete all
     files under the table location via `WalkDir` + `BulkRemovableIO` fallback
   - **Glue**: same pattern; falls back to metadata-only drop if table files
     are inaccessible (e.g. S3 permissions)
   - **Hive**: same pattern; falls back to metadata-only drop on load failure
   - **Hadoop**: delegates to `DropTable` which already removes the directory 
tree
   - **REST**: existing `PurgeTable` (`purgeRequested=true`) satisfies the
     interface automatically — no changes needed
   
   ### CLI
   - `cmd/iceberg/main.go` — wire `--purge` flag into `drop table` command
     via type assertion against `PurgeableTable`; exits with an error if the
     catalog does not support client-side purge
   
   ## Notes
   - No breaking changes to `Catalog.DropTable` signature
   - Client-side purge is best-effort — if interrupted between catalog drop
     and file deletion, orphaned files may remain. For reliable cleanup,
     prefer `expire-snapshots` + `remove-orphan-files`
   - REST catalog delegates purge to the server as before
   
   ## Testing
   - `catalog/sql/sql_test.go` — verifies physical file deletion on local 
storage
   - `catalog/glue/glue_test.go` — mock test for purge invocation and fallback
   - `catalog/hive/hive_test.go` — mock test for purge invocation and fallback
   - `cmd/iceberg/drop_test.go` — CLI flag parsing and purge dispatch tests


-- 
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]

Reply via email to