{"record":{"id":"58ed1bdf8b826a31","repo":"apache/iceberg","slug":"this-getclass-getname-does-not-implement-u","errorCode":null,"errorMessage":"this.getClass().getName() + \" does not implement update\"","messagePattern":"this\\.getClass\\(\\)\\.getName\\(\\) \\+ \" does not implement update\"","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkPositionDeltaWrite.java","lineNumber":647,"sourceCode":"\n    @Override\n    public void delete(InternalRow metadata, InternalRow id) throws IOException {\n      int specId = metadata.getInt(specIdOrdinal);\n      PartitionSpec spec = specs.get(specId);\n\n      InternalRow partition = metadata.getStruct(partitionOrdinal, partitionRowWrapper.size());\n      StructProjection partitionProjection = partitionProjections.get(specId);\n      partitionProjection.wrap(partitionRowWrapper.wrap(partition));\n\n      String file = id.getString(fileOrdinal);\n      long position = id.getLong(positionOrdinal);\n      positionDelete.set(file, position);\n      delegate.write(positionDelete, spec, partitionProjection);\n    }\n\n    @Override\n    public void update(InternalRow metadata, InternalRow id, InternalRow row) {\n      throw new UnsupportedOperationException(\n          this.getClass().getName() + \" does not implement update\");\n    }\n\n    @Override\n    public void insert(InternalRow row) throws IOException {\n      throw new UnsupportedOperationException(\n          this.getClass().getName() + \" does not implement insert\");\n    }\n\n    @Override\n    public WriterCommitMessage commit() throws IOException {\n      close();\n\n      DeleteWriteResult result = delegate.result();\n      return new DeltaTaskCommit(result);\n    }\n\n    @Override","sourceCodeStart":629,"sourceCodeEnd":665,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkPositionDeltaWrite.java#L629-L665","documentation":"The writer used for Spark's position-delta row-level operations does not implement the update() operation of the DeltaWriter interface. Iceberg represents updates in Copy-on-Write/Merge-on-Read mode as a paired delete plus insert, so a direct row update is never supported by this writer class. The exception reports the concrete class name to identify which writer variant was invoked.","triggerScenarios":"Spark calls DeltaWriter.update(InternalRow metadata, InternalRow id, InternalRow row) on the position-delete-based writer inside SparkPositionDeltaWrite, e.g. when a row-level operation (UPDATE/MERGE/DELETE) attempts to route an updated row through update() instead of delete()+insert().","commonSituations":"Engine-internal code paths or custom Delta W handlers invoking update(); Spark planner changes routing updated rows directly; custom code reusing the writer API outside the normal delete+insert flow.","solutions":["Do not call update() on this writer; emit a delete followed by an insert for the changed row.","Ensure the row-level operation mode (write.merge/rewrite or copy-on-write settings) routes updates through the standard delete+insert path.","If this arises from Spark itself, report it with the Spark/Iceberg version; it indicates an unexpected planner path.","Upgrade to a newer Iceberg release where the delta write path may handle this differently."],"exampleFix":"// before\nwriter.update(metadata, id, row);\n// after\nwriter.delete(metadata, id);\nwriter.insert(row);","handlingStrategy":"try-catch","validationCode":"if (deltaWriter instanceof PositionDeleteWriter) { throw new IllegalStateException(\"use delete+insert instead of update\"); }","typeGuard":null,"tryCatchPattern":"try { writer.update(meta, id, row); } catch (UnsupportedOperationException e) { writer.delete(meta, id); writer.insert(row); }","preventionTips":["Never call update() on SparkPositionDeltaWrite writers","Always model updates as delete+insert","Read the DeltaWriter interface docs before implementing custom handlers"],"tags":["unsupported-operation","spark","row-level-operations"],"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-23T08:17:48.524Z"}