Skip to main content

DeleteReachableFiles

The DeleteReachableFiles action deletes all files referenced by a table metadata file. This action is used to completely clean up table storage after a table is dropped and no longer needed.

Interface

Overview

When a table is dropped, its metadata is removed from the catalog, but the underlying data files remain in storage. This action provides a way to irreversibly delete all reachable files including:
  • Data files
  • Delete files (both equality and position deletes)
  • Manifest files
  • Manifest list files
  • Metadata JSON files
  • Version hint files
This action permanently deletes files and cannot be undone. Use with extreme caution and only after confirming the table is no longer needed.

Methods

deleteWith

Provides a custom delete function for file removal.
Parameters:
  • deleteFunc - A function that accepts a file path and performs the deletion
Returns: this for method chaining Example:

executeDeleteWith

Provides an executor service for parallel file deletion.
Parameters:
  • executorService - The executor service to use for parallel deletes
Returns: this for method chaining
This executor service is only used if a custom delete function is provided via deleteWith() or if the FileIO doesn’t support bulk operations. Otherwise, parallelism is controlled by the FileIO’s bulk delete implementation.

io

Sets the FileIO to use for file removal.
Parameters:
  • io - The FileIO instance to use for file operations
Returns: this for method chaining Example:

Result

The Result interface provides statistics about the deletion operation.

Methods

deletedDataFilesCount

Returns the number of deleted data files.

deletedEqualityDeleteFilesCount

Returns the number of deleted equality delete files.

deletedPositionDeleteFilesCount

Returns the number of deleted position delete files.

deletedManifestsCount

Returns the number of deleted manifest files.

deletedManifestListsCount

Returns the number of deleted manifest list files.

deletedOtherFilesCount

Returns the number of deleted metadata JSON and version hint files.

Usage Examples

Basic Table Cleanup

With Custom Delete Function

With Parallel Execution

With Custom FileIO

Complete Cleanup with Verification

Best Practices

  1. Verify before deletion: Ensure the table is truly no longer needed before running this action
  2. Check catalog state: Confirm the table has been dropped from the catalog
  3. Backup metadata: Keep a backup of the metadata file if recovery might be needed
  4. Use correct metadata file: Point to the latest metadata file for the dropped table
  5. Monitor progress: Track deletion results to ensure all files are removed
  6. Test in non-production: Verify the action works as expected before running in production
This action is destructive and irreversible. There is no way to recover data after deletion. Always verify the table is no longer needed.

Important Notes

  • Metadata file required: You must provide the path to a metadata file, not a table identifier
  • All snapshots deleted: All data from all snapshots will be removed
  • No catalog interaction: This action only deletes files; it does not interact with the catalog
  • Parallel execution: FileIOs that support bulk operations will handle parallelism automatically