{"record":{"id":"5de8f96e50d80854","repo":"apache/iceberg","slug":"sort-rewrite-strategy-not-implemented-for-this-fra","errorCode":null,"errorMessage":"SORT Rewrite Strategy not implemented for this framework","messagePattern":"SORT Rewrite Strategy not implemented for this framework","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/actions/RewriteDataFiles.java","lineNumber":165,"sourceCode":"   */\n  String OUTPUT_SPEC_ID = \"output-spec-id\";\n\n  /**\n   * Choose BINPACK as a strategy for this rewrite operation\n   *\n   * @return this for method chaining\n   */\n  default RewriteDataFiles binPack() {\n    return this;\n  }\n\n  /**\n   * Choose SORT as a strategy for this rewrite operation using the table's sortOrder\n   *\n   * @return this for method chaining\n   */\n  default RewriteDataFiles sort() {\n    throw new UnsupportedOperationException(\n        \"SORT Rewrite Strategy not implemented for this framework\");\n  }\n\n  /**\n   * Choose SORT as a strategy for this rewrite operation and manually specify the sortOrder to use\n   *\n   * @param sortOrder user defined sortOrder\n   * @return this for method chaining\n   */\n  default RewriteDataFiles sort(SortOrder sortOrder) {\n    throw new UnsupportedOperationException(\n        \"SORT Rewrite Strategy not implemented for this framework\");\n  }\n\n  /**\n   * Choose Z-ORDER as a strategy for this rewrite operation with a specified list of columns to use\n   *\n   * @param columns Columns to be used to generate Z-Values","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/actions/RewriteDataFiles.java#L147-L183","documentation":"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.","triggerScenarios":"Calling rewriteDataFiles().sort() (no-arg) on a RewriteDataFiles implementation (e.g. a Flink or custom binding) that has not overridden the default sort() method.","commonSituations":"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.","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"],"exampleFix":"// before\nRewriteDataFiles.Result r = actions.rewriteDataFiles(table)\n    .sort()\n    .execute();\n// after\nRewriteDataFiles.Result r = actions.rewriteDataFiles(table)\n    .binpack()\n    .execute();","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  rewrite.sort();\n} catch (UnsupportedOperationException e) {\n  rewrite.binpack(); // fallback strategy\n}","preventionTips":["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"],"tags":["unsupported-operation","java","compaction","sort-strategy"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}