apache/iceberg · error · UnsupportedOperationException
SORT Rewrite Strategy not implemented for this framework
Error message
SORT Rewrite Strategy not implemented for this framework
What it means
RewriteDataFiles.sort() selects the SORT rewrite strategy using the table's sort order. The interface default throws UnsupportedOperationException because every framework binding must implement strategy selection itself; invoking the stub means the current framework has not implemented the SORT strategy.
Solutions
- Use an implementation that supports SORT rewriting (e.g. SparkActions' RewriteDataFiles)
- Switch the strategy to binpack(), which is the broadly supported default
- Upgrade the engine integration version where the SORT strategy override was added
- Pre-sort data out-of-band (e.g. write with a sort order) and then run a binpack rewrite
Example fix
// before
RewriteDataFiles.Result r = actions.rewriteDataFiles(table)
.sort()
.execute();
// after
RewriteDataFiles.Result r = actions.rewriteDataFiles(table)
.binpack()
.execute(); Defensive patterns
Strategy: fallback
Try / catch
try {
rewrite.sort();
} catch (UnsupportedOperationException e) {
rewrite.binpack(); // fallback strategy
} Prevention
- Use SparkActions when SORT/Z-ORDER/HILBERT strategies are required
- Default to binpack() on non-Spark engines
- Confirm strategy overrides exist on the concrete RewriteDataFiles class
- Pre-sort data at write time if the rewrite strategy is unavailable
When it happens
Trigger: Calling rewriteDataFiles().sort() (no-arg) on a RewriteDataFiles implementation (e.g. a Flink or custom binding) that has not overridden the default sort() method.
Common situations: Developers porting compaction jobs from Spark to another engine, or using an older/custom RewriteDataFiles implementation that only supports the BINPACK strategy, hit the stub at strategy-selection time.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- HILBERT Rewrite Strategy not implemented for this framework
- Z-ORDER Rewrite Strategy not implemented for this framework
- Backup table name cannot be specified
- Batch reading is not supported in non-vectorized reader
- Bucket transform is not supported
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/5de8f96e50d80854.
Report an issue: GitHub.
Appendix: source
Thrown at api/src/main/java/org/apache/iceberg/actions/RewriteDataFiles.java:165
*/
String OUTPUT_SPEC_ID = "output-spec-id";
/**
* Choose BINPACK as a strategy for this rewrite operation
*
* @return this for method chaining
*/
default RewriteDataFiles binPack() {
return this;
}
/**
* Choose SORT as a strategy for this rewrite operation using the table's sortOrder
*
* @return this for method chaining
*/
default RewriteDataFiles sort() {
throw new UnsupportedOperationException(
"SORT Rewrite Strategy not implemented for this framework");
}
/**
* Choose SORT as a strategy for this rewrite operation and manually specify the sortOrder to use
*
* @param sortOrder user defined sortOrder
* @return this for method chaining
*/
default RewriteDataFiles sort(SortOrder sortOrder) {
throw new UnsupportedOperationException(
"SORT Rewrite Strategy not implemented for this framework");
}
/**
* Choose Z-ORDER as a strategy for this rewrite operation with a specified list of columns to use
*
* @param columns Columns to be used to generate Z-ValuesView on GitHub (pinned to 86d9c8fc54)