{"record":{"id":"31813309109819aa","repo":"apache/iceberg","slug":"updating-partition-statistics-is-not-supported-by","errorCode":null,"errorMessage":"Updating partition statistics is not supported by + getClass().getName()","messagePattern":"Updating partition statistics is not supported by \\+ getClass\\(\\)\\.getName\\(\\)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/Table.java","lineNumber":309,"sourceCode":"  /**\n   * Create a new {@link UpdateStatistics update table statistics API} to add or remove statistics\n   * files in this table.\n   *\n   * @return a new {@link UpdateStatistics}\n   */\n  default UpdateStatistics updateStatistics() {\n    throw new UnsupportedOperationException(\n        \"Updating statistics is not supported by \" + getClass().getName());\n  }\n\n  /**\n   * Create a new {@link UpdatePartitionStatistics update partition statistics API} to add or remove\n   * partition statistics files in this table.\n   *\n   * @return a new {@link UpdatePartitionStatistics}\n   */\n  default UpdatePartitionStatistics updatePartitionStatistics() {\n    throw new UnsupportedOperationException(\n        \"Updating partition statistics is not supported by \" + getClass().getName());\n  }\n\n  /**\n   * Create a new {@link ExpireSnapshots expire API} to expire snapshots in this table and commit.\n   *\n   * @return a new {@link ExpireSnapshots}\n   */\n  ExpireSnapshots expireSnapshots();\n\n  /**\n   * Create a new {@link ManageSnapshots manage snapshots API} to manage snapshots in this table and\n   * commit.\n   *\n   * @return a new {@link ManageSnapshots}\n   */\n  ManageSnapshots manageSnapshots();\n","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/Table.java#L291-L327","documentation":"The default Table.updatePartitionStatistics() implementation throws UnsupportedOperationException because the concrete Table implementation cannot add or remove partition statistics files. Like the table-statistics variant, it names the class that lacks support; implementations must override it to support partition statistics writes.","triggerScenarios":"Calling table.updatePartitionStatistics() on an implementation that does not override the default — metadata tables, custom Table wrappers, or catalogs without partition statistics support. Also hit via test helpers building partition statistics (e.g. tableWithTwoPartitions-style fixtures) against such tables.","commonSituations":"Running partition-stats maintenance (projecting stat fields, v2-to-v3 schema evolution tests) on tables from catalogs that predate partition statistics support; using wrapped tables that forward reads but not stats writes.","solutions":["Use the underlying BaseTable implementation rather than a metadata table or wrapper.","Upgrade the catalog/table implementation to one supporting partition statistics.","Catch UnsupportedOperationException and skip partition statistics updates.","Override updatePartitionStatistics() in custom Table implementations."],"exampleFix":"// before\ntable.updatePartitionStatistics().addPartitionStatisticsFile(file).commit();\n\n// after\ntry {\n  table.updatePartitionStatistics().addPartitionStatisticsFile(file).commit();\n} catch (UnsupportedOperationException e) {\n  LOG.warn(\"Partition statistics not supported for {}\", table.name());\n}","handlingStrategy":"try-catch","validationCode":"// verify support before staging partition statistics\nif (!table.implersions().isEmpty()) { /* placeholder */ }\ntry { table.updatePartitionStatistics(); } catch (UnsupportedOperationException e) { skip(); }","typeGuard":"boolean supportsPartitionStatsUpdate(Table t) {\n  try { t.updatePartitionStatistics(); return true; }\n  catch (UnsupportedOperationException e) { return false; }\n}","tryCatchPattern":"try {\n  table.updatePartitionStatistics().addPartitionStatisticsFile(f).commit();\n} catch (UnsupportedOperationException e) {\n  LOG.warn(\"Partition statistics update unsupported for {}\", table.name());\n}","preventionTips":["Confirm the catalog/table implementation supports partition statistics (Iceberg format v3-era feature)","Unwrap SerializableTable/MetadataTable wrappers before stats writes","Add capability checks in maintenance frameworks instead of assuming support"],"tags":["unsupported-operation","partition-statistics","api-default-method"],"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"}