{"record":{"id":"346e6cc80d9ede58","repo":"apache/iceberg","slug":"table-does-not-implement-s-s-s","errorCode":null,"errorMessage":"Table does not implement %s: %s (%s)","messagePattern":"Table does not implement (.+?): (.+?) \\((.+?)\\)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/RollbackStagedTable.java","lineNumber":136,"sourceCode":"  @Override\n  public WriteBuilder newWriteBuilder(LogicalWriteInfo info) {\n    return callReturning(SupportsWrite.class, t -> t.newWriteBuilder(info));\n  }\n\n  private <T> void call(Class<? extends T> requiredClass, Consumer<T> task) {\n    callReturning(\n        requiredClass,\n        inst -> {\n          task.accept(inst);\n          return null;\n        });\n  }\n\n  private <T, R> R callReturning(Class<? extends T> requiredClass, Function<T, R> task) {\n    if (requiredClass.isInstance(table)) {\n      return task.apply(requiredClass.cast(table));\n    } else {\n      throw new UnsupportedOperationException(\n          String.format(\n              \"Table does not implement %s: %s (%s)\",\n              requiredClass.getSimpleName(), table.name(), table.getClass().getName()));\n    }\n  }\n}\n","sourceCodeStart":118,"sourceCodeEnd":143,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/RollbackStagedTable.java#L118-L143","documentation":"RollbackStagedTable delegates operations by casting its wrapped table to required interfaces (RowLevelOperation's scan/write builders etc.); callReturning throws UnsupportedOperationException 'Table does not implement %s: %s (%s)' when the underlying table lacks the needed interface. This means the targeted table object can't support the requested row-level/rollback capability.","triggerScenarios":"Spark DELETE/UPDATE/MERGE INTO (row-level operations) or rollback against an Iceberg table whose implementation does not implement the required internal interface (e.g. a v1-table wrapper, a foreign Spark table, or a catalog returning a plain SparkTable without extendsTable/rollback support).","commonSituations":"Running MERGE/DELETE against a table from a non-Iceberg catalog masquerading as Iceberg; mixed Iceberg versions where Spark 3.5 bundles an older table wrapper lacking newer interfaces; pointing a row-level SQL at a view or temporary staged table that lacks the interface.","solutions":["Ensure the table is loaded from the Iceberg catalog so the correct SparkTable implementation (with all capability interfaces) is used.","Align the iceberg-spark runtime jar version with your Spark version (3.5) — version skew causes missing interfaces on the wrapped table.","Verify the SQL target is a real Iceberg table, not a view/temp view/foreign table; row-level ops require table implementations that support the operation.","If implementing a custom Catalog/TablePlugin, make your table implement the required interfaces (e.g. SupportsRowLevelOperations) that RollbackStagedTable expects."],"exampleFix":"// before\n// custom catalog returns a bare table\nreturn new MySimpleTable(...);\n// after\npublic class MySparkTable extends SparkTable implements SupportsRowLevelOperations { ... }\nreturn new MySparkTable(...);","handlingStrategy":"validation","validationCode":"Table sparkTable = ((SparkTable) catalog.loadTable(ident)).table();\nif (!(sparkTable instanceof SupportsRowLevelOperations)) {\n  throw new IllegalStateException(\"Target table does not support row-level operations\");\n}","typeGuard":null,"tryCatchPattern":"try { spark.sql(\"DELETE FROM cat.db.t WHERE id = 1\"); } catch (UnsupportedOperationException e) { LOG.error(\"Table lacks required interface: {}\", e.getMessage()); }","preventionTips":["Load tables through the Iceberg catalog for row-level SQL operations","Keep iceberg-spark runtime jar version aligned with the Spark major.minor","Don't target views or custom tables that omit the required capability interfaces"],"tags":["spark","row-level-operations","type-mismatch"],"backgroundTag":"type-mismatch","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"}