{"record":{"id":"f2e1fcaa4b616178","repo":"apache/iceberg","slug":"this-getclass-getname-doesn-t-implement-so","errorCode":null,"errorMessage":"this.getClass().getName() + \" doesn't implement sortBy(List<String>)\"","messagePattern":"this\\.getClass\\(\\)\\.getName\\(\\) \\+ \" doesn't implement sortBy\\(List<String>\\)\"","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/actions/RewriteManifests.java","lineNumber":69,"sourceCode":"   * <p>Supply an optional set of partition field names to sort the rewritten manifests by. Choosing\n   * a frequently queried partition field can reduce planning time by skipping unnecessary\n   * manifests.\n   *\n   * <p>For example, given a table PARTITIONED BY (a, b, c, d), one may wish to rewrite and sort\n   * manifests by ('d', 'b') only, based on known query patterns. Rewriting Manifests in this way\n   * will yield a manifest_list whose manifest_files point to data files containing common 'd' then\n   * 'b' partition values.\n   *\n   * <p>If not set, manifests will be rewritten in the order of the transforms in the table's\n   * partition spec.\n   *\n   * @param partitionFields Exact transformed column names used for partitioning; not the raw column\n   *     names that partitions are derived from. E.G. supply 'data_bucket' and not 'data' for a\n   *     bucket(N, data) partition * definition\n   * @return this for method chaining\n   */\n  default RewriteManifests sortBy(List<String> partitionFields) {\n    throw new UnsupportedOperationException(\n        this.getClass().getName() + \" doesn't implement sortBy(List<String>)\");\n  }\n\n  /**\n   * Passes a location where the staged manifests should be written.\n   *\n   * <p>If not set, defaults to the table's metadata location.\n   *\n   * @param stagingLocation a staging location\n   * @return this for method chaining\n   */\n  RewriteManifests stagingLocation(String stagingLocation);\n\n  /** The action result that contains a summary of the execution. */\n  interface Result {\n    /** Returns rewritten manifests. */\n    Iterable<ManifestFile> rewrittenManifests();\n","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/actions/RewriteManifests.java#L51-L87","documentation":"RewriteManifests.sortBy(List<String>) asks the rewrite-manifests action to cluster manifests by the given partition fields. The interface default throws UnsupportedOperationException with the concrete class name, because some implementations (e.g. Flink's) do not support custom manifest clustering.","triggerScenarios":"Calling rewriteManifests(table).sortBy(partitionFields) on an implementation keeping the default stub; the message names the concrete class, e.g. \"...RewriteManifestsFlinkImpl doesn't implement sortBy(List<String>)\".","commonSituations":"Users porting Spark manifest-compaction jobs that group manifests by partition to Flink or custom engines where only default (writer-based) clustering exists.","solutions":["Remove sortBy(...) and run the rewrite with the implementation's default clustering","Use Spark's RewriteManifests implementation, which supports sortBy","Check the concrete class for a sortBy override before configuring partition clustering","Implement sortBy in a custom action binding if partition-clustered manifests are required"],"exampleFix":"// before\nRewriteManifests.Result r = actions.rewriteManifests(table)\n    .sortBy(List.of(\"data_bucket\"))\n    .execute();\n// after\nRewriteManifests.Result r = actions.rewriteManifests(table)\n    .execute(); // default clustering","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  rewriteManifests.sortBy(partitionFields);\n} catch (UnsupportedOperationException e) {\n  // run with default manifest clustering\n}","preventionTips":["Only use sortBy on implementations that support partition-clustered manifests (Spark)","Read the UnsupportedOperationException message: it names the concrete class lacking support","Keep manifest compaction logic per-engine","Add a capability check before configuring manifest clustering"],"tags":["unsupported-operation","java","manifests","fluent-api"],"backgroundTag":"method-not-implemented","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}