RemoveDanglingDeleteFiles
TheRemoveDanglingDeleteFiles 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
- Consume storage unnecessarily
- Add overhead to query planning
- Provide no value since their target data is gone
Methods
This action has no additional configuration methods beyond the standardexecute() method inherited from the Action interface.
Result
TheResult 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
- Run after data file operations: Execute this action after data compaction, rewriting, or expiration
- Combine with maintenance tasks: Include in regular table maintenance workflows
- Monitor results: Track the number and size of removed files to understand table health
- Schedule regularly: Run periodically for tables with frequent delete operations
- 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
RunRemoveDanglingDeleteFiles 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
Related
- RewriteDataFiles - Compact data files (often creates dangling deletes)
- RewritePositionDeleteFiles - Optimize position delete files
- ConvertEqualityDeleteFiles - Convert equality to position deletes
- ExpireSnapshots - Clean up old snapshots to reclaim storage