{"record":{"id":"933c8d716ba56e1a","repo":"apache/iceberg","slug":"operation-updatestatistics-is-not-supported-after","errorCode":null,"errorMessage":"Operation updateStatistics is not supported after the table is serialized","messagePattern":"Operation updateStatistics is not supported after the table is serialized","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/SerializableTable.java","lineNumber":412,"sourceCode":"\n  @Override\n  public RowDelta newRowDelta() {\n    throw new UnsupportedOperationException(errorMsg(\"newRowDelta\"));\n  }\n\n  @Override\n  public ReplacePartitions newReplacePartitions() {\n    throw new UnsupportedOperationException(errorMsg(\"newReplacePartitions\"));\n  }\n\n  @Override\n  public DeleteFiles newDelete() {\n    throw new UnsupportedOperationException(errorMsg(\"newDelete\"));\n  }\n\n  @Override\n  public UpdateStatistics updateStatistics() {\n    throw new UnsupportedOperationException(errorMsg(\"updateStatistics\"));\n  }\n\n  @Override\n  public UpdatePartitionStatistics updatePartitionStatistics() {\n    throw new UnsupportedOperationException(errorMsg(\"updatePartitionStatistics\"));\n  }\n\n  @Override\n  public ExpireSnapshots expireSnapshots() {\n    throw new UnsupportedOperationException(errorMsg(\"expireSnapshots\"));\n  }\n\n  @Override\n  public ManageSnapshots manageSnapshots() {\n    throw new UnsupportedOperationException(errorMsg(\"manageSnapshots\"));\n  }\n\n  @Override","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/SerializableTable.java#L394-L430","documentation":"SerializableTable is the serialized, read-only representation of a table used on distributed workers; it has no catalog connection, so any metadata commit is impossible. updateStatistics() would write new statistics files and commit table metadata, hence it throws UnsupportedOperationException with this message.","triggerScenarios":"Calling table.updateStatistics() on a SerializableTable produced by SerializableTable.wrap(...) and deserialized in a task, e.g. an analytics job computing statistics on workers and trying to commit them directly.","commonSituations":"Statistics collection jobs that serialize the Table and attempt to publish stats from executors; maintenance utilities sharing Table objects between driver and workers.","solutions":["Commit statistics via the catalog-backed table: catalog.loadTable(id).updateStatistics()...commit()","Collect statistics on workers, return them, and commit from the driver using the live Table","Use engine-native ANALYZE/statistics tooling instead of manual commits in executors","Check for SerializableTable instances before calling metadata-mutating methods"],"exampleFix":"// before\nTable table = serializedTable;\ntable.updateStatistics().setStatisticsSnapshot(statisticsFile).commit();\n// after\nTable table = catalog.loadTable(identifier);\ntable.updateStatistics().setStatisticsSnapshot(statisticsFile).commit();","handlingStrategy":"try-catch","validationCode":"if (table instanceof org.apache.iceberg.SerializableTable) {\n  throw new IllegalStateException(\"updateStatistics() requires a catalog-backed Table\");\n}","typeGuard":"boolean canUpdateStats = !(table instanceof org.apache.iceberg.SerializableTable);","tryCatchPattern":"try {\n  table.updateStatistics().setStatisticsSnapshot(sf).commit();\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"not supported after the table is serialized\")) {\n    catalog.loadTable(identifier).updateStatistics().setStatisticsSnapshot(sf).commit();\n  } else { throw e; }\n}","preventionTips":["Collect stats on workers, commit stats on the driver","Only call metadata-mutating methods on Tables loaded from a Catalog","Avoid shipping Table objects into executor code at all","Add explicit type checks in maintenance utilities"],"tags":["java","iceberg","unsupported-operation","serialization"],"backgroundTag":"unsupported-operation","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"}