{"record":{"id":"905c8fe6b02fc450","repo":"apache/iceberg","slug":"s-does-not-implement-datasequencenumber","errorCode":null,"errorMessage":"%s does not implement dataSequenceNumber","messagePattern":"(.+?) does not implement dataSequenceNumber","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/RewriteFiles.java","lineNumber":129,"sourceCode":"   * @param deleteFile a new delete file\n   * @param dataSequenceNumber data sequence number to append on the file\n   * @return this for method chaining\n   */\n  default RewriteFiles addFile(DeleteFile deleteFile, long dataSequenceNumber) {\n    throw new UnsupportedOperationException(\n        this.getClass().getName() + \" does not implement addFile\");\n  }\n\n  /**\n   * Configure the data sequence number for this rewrite operation. This data sequence number will\n   * be used for all new data files that are added in this rewrite. This method is helpful to avoid\n   * commit conflicts between data compaction and adding equality deletes.\n   *\n   * @param sequenceNumber a data sequence number\n   * @return this for method chaining\n   */\n  default RewriteFiles dataSequenceNumber(long sequenceNumber) {\n    throw new UnsupportedOperationException(\n        this.getClass().getName() + \" does not implement dataSequenceNumber\");\n  }\n\n  /**\n   * Add a rewrite that replaces one set of data files with another set that contains the same data.\n   *\n   * @param filesToDelete files that will be replaced (deleted), cannot be null or empty.\n   * @param filesToAdd files that will be added, cannot be null or empty.\n   * @return this for method chaining\n   * @deprecated since 1.3.0, will be removed in 2.0.0\n   */\n  @Deprecated\n  default RewriteFiles rewriteFiles(Set<DataFile> filesToDelete, Set<DataFile> filesToAdd) {\n    return rewriteFiles(filesToDelete, ImmutableSet.of(), filesToAdd, ImmutableSet.of());\n  }\n\n  /**\n   * Add a rewrite that replaces one set of data files with another set that contains the same data.","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/RewriteFiles.java#L111-L147","documentation":"RewriteFiles.dataSequenceNumber(long) is a default interface method that sets the data sequence number applied to all files added by the rewrite, used to avoid commit conflicts between compaction and concurrent equality deletes. The default throws UnsupportedOperationException, signaling the implementation does not support explicit sequence-number assignment.","triggerScenarios":"Calling dataSequenceNumber(long) on a RewriteFiles implementation that does not override it — e.g. doReplace/commitFileGroups paths running against a custom or outdated RewriteFiles.","commonSituations":"Iceberg runtimes predating the sequence-number rewrite feature (added to prevent conflicts with equality-delete writers); custom table operation implementations in tests or third-party catalogs.","solutions":["Upgrade iceberg-core so BaseRewriteFiles overrides dataSequenceNumber(long).","If not needed, drop the call and let the operation derive the sequence number from the current snapshot.","In custom implementations, override dataSequenceNumber(long) to store the sequence number used for added files."],"exampleFix":"// before\nRewriteFiles rewrite = new OldRewriteFiles();\nrewrite.dataSequenceNumber(seq); // UnsupportedOperationException\n// after\nRewriteFiles rewrite = table.newRewrite(); // standard impl\nrewrite.dataSequenceNumber(seq);","handlingStrategy":"try-catch","validationCode":"Preconditions.checkArgument(rewrite.getClass().getName().startsWith(\"org.apache.iceberg.\"), \"dataSequenceNumber requires the stock BaseRewriteFiles\");","typeGuard":"static boolean supportsDataSequenceNumber(RewriteFiles rf) { return rf instanceof BaseRewriteFiles; }","tryCatchPattern":"try {\n  rewrite.dataSequenceNumber(seq);\n} catch (UnsupportedOperationException e) {\n  LOG.warn(\"RewriteFiles impl does not support explicit data sequence number; skipping\", e);\n}","preventionTips":["Upgrade iceberg-core if compaction must avoid conflicts with equality deletes.","Call dataSequenceNumber before addFile calls so ordering stays valid.","Only use standard table.newRewrite() instances for compaction actions."],"tags":["java","iceberg","sequence-number","unsupported-operation"],"backgroundTag":"unsupported-operation","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"}