Skip to main content

RemoveDanglingDeleteFiles

The RemoveDanglingDeleteFiles action removes dangling delete files from the current snapshot. A delete file is considered dangling if its deletes no longer apply to any live data files.

Interface

Overview

Delete files (both position and equality deletes) reference specific data files. When data files are removed through operations like:
  • Data file compaction/rewriting
  • Partition dropping
  • Data expiration
The delete files may become “dangling” - they no longer apply to any data files in the current snapshot. These dangling delete files:
  • Consume storage unnecessarily
  • Add overhead to query planning
  • Provide no value since their target data is gone
This action identifies and removes such dangling delete files to optimize table performance and reduce storage costs.

Methods

This action has no additional configuration methods beyond the standard execute() method inherited from the Action interface.

Result

The Result interface provides information about the removed delete files.

Methods

removedDeleteFiles

Returns an iterable collection of the delete files that were removed. Returns: Iterable<DeleteFile> - The removed delete files

Usage Examples

Basic Removal

Analyze Removed Files

Log Removed Files

Check Before and After

Run After Compaction

Monitor Storage Savings

Best Practices

  1. Run after data file operations: Execute this action after data compaction, rewriting, or expiration
  2. Combine with maintenance tasks: Include in regular table maintenance workflows
  3. Monitor results: Track the number and size of removed files to understand table health
  4. Schedule regularly: Run periodically for tables with frequent delete operations
  5. Run before statistics: Remove dangling files before computing table statistics
This action only removes delete files that are definitively dangling. It’s safe to run regularly without risk of removing valid delete files.

When to Run This Action

Run RemoveDanglingDeleteFiles after:
  • Data file compaction: When data files are rewritten or merged
  • Partition drops: When entire partitions are removed
  • Data expiration: When old data is deleted
  • Table optimization: As part of routine maintenance

Performance Impact

  • Planning overhead reduction: Fewer delete files means faster query planning
  • Storage savings: Removes unnecessary files from storage
  • Scan performance: Reduces metadata that needs to be processed
  • Minimal cost: The action itself is lightweight and metadata-focused
This action creates a new snapshot. Remember to expire old snapshots to fully reclaim storage.