{"record":{"id":"52d4aa571237c58d","repo":"apache/iceberg","slug":"this-getclass-getname-does-not-implement-i","errorCode":null,"errorMessage":"this.getClass().getName() + \" does not implement insert\"","messagePattern":"this\\.getClass\\(\\)\\.getName\\(\\) \\+ \" does not implement insert\"","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkPositionDeltaWrite.java","lineNumber":653,"sourceCode":"      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\n    public void abort() throws IOException {\n      close();\n\n      DeleteWriteResult result = delegate.result();\n      SparkCleanupUtil.deleteTaskFiles(io, result.deleteFiles());\n    }","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkPositionDeltaWrite.java#L635-L671","documentation":"The position-delete-based writer in SparkPositionDeltaWrite does not implement insert(). In this writer variant rows are only written as position deletes against existing files, so inserting new data rows is not supported; the class name in the message identifies the offending writer.","triggerScenarios":"DeltaWriter.insert(InternalRow row) is invoked on the position-delete writer of SparkPositionDeltaWrite, i.e. when the framework asks a delete-only writer to add new rows.","commonSituations":"Custom DeltaWriter usage mixing insert semantics with a position-delete writer; engine code routing copied/updated rows to the wrong writer during MERGE/UPDATE execution.","solutions":["Use the copy-on-write/merge-on-read writer variants (which implement insert via reinsert) for rows that must be written.","Restrict this writer to delete-only operations; route inserts to the corresponding data writer.","Check that the row-level operation mode matches the intended write type before execution.","Upgrade Iceberg if this occurs in an unmodified engine integration."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (writer instanceof SparkPositionDeltaWrite.PositionDeltaWriter) { /* inserts unsupported here */ }","typeGuard":null,"tryCatchPattern":"try { writer.insert(row); } catch (UnsupportedOperationException e) { routeInsertToDataWriter(row); }","preventionTips":["Route inserts to writers that implement insert()","Keep position-delete writers delete-only","Check the writer class before dispatching operations"],"tags":["unsupported-operation","spark","position-delete"],"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-14T11:17:12.474Z"}