{"record":{"id":"d9dcb6b9b92cf0c6","repo":"apache/iceberg","slug":"partition-statistics-scan-is-not-supported","errorCode":null,"errorMessage":"Partition statistics scan is not supported","messagePattern":"Partition statistics scan is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/Table.java","lineNumber":95,"sourceCode":"   *\n   * <p>Once a scan is created, it can be refined to project columns and filter data.\n   *\n   * @return an incremental changelog scan\n   */\n  default IncrementalChangelogScan newIncrementalChangelogScan() {\n    throw new UnsupportedOperationException(\"Incremental changelog scan is not supported\");\n  }\n\n  /**\n   * Create a new {@link PartitionStatisticsScan} for this table.\n   *\n   * <p>Once a partition statistics scan is created, it can be refined to project columns and filter\n   * data.\n   *\n   * @return a partition statistics scan for this table\n   */\n  default PartitionStatisticsScan newPartitionStatisticsScan() {\n    throw new UnsupportedOperationException(\"Partition statistics scan is not supported\");\n  }\n\n  /**\n   * Return the {@link Schema schema} for this table.\n   *\n   * @return this table's schema\n   */\n  Schema schema();\n\n  /**\n   * Return a map of {@link Schema schema} for this table.\n   *\n   * @return this table's schema map\n   */\n  Map<Integer, Schema> schemas();\n\n  /**\n   * Return the {@link PartitionSpec partition spec} for this table.","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/Table.java#L77-L113","documentation":"This UnsupportedOperationException comes from the default implementation of Table.newPartitionStatisticsScan() in the Iceberg API. It signals that the concrete Table implementation does not support scanning partition statistics files. Only certain implementations (e.g. those backed by full metadata such as BaseTable) override this; metadata tables, wrappers, or read-only views leave the default throwing version in place.","triggerScenarios":"Calling table.newPartitionStatisticsScan() on a Table implementation that does not override the method — e.g. a metadata table (Table), a wrapped/custom Table, or a StaticTable-like implementation. Raised directly from the default method body at Table.java:95.","commonSituations":"Running maintenance or analysis jobs (e.g. computeAndMergeStatsIncremental) against tables obtained through catalogs or wrappers that don't implement partition stats; using metadata tables as if they were normal tables; custom Catalog implementations returning partially-implemented Table objects.","solutions":["Check the concrete Table type before calling; only call newPartitionStatisticsScan() on tables that implement it (e.g. unwrap to the underlying BaseTable).","Upgrade the Iceberg catalog implementation to a version that supports partition statistics scans.","Catch UnsupportedOperationException and skip partition-statistics computation gracefully.","If you wrote a custom Table implementation, override newPartitionStatisticsScan() to return a real PartitionStatisticsScan."],"exampleFix":"// before\nPartitionStatisticsScan scan = table.newPartitionStatisticsScan();\n\n// after\nPartitionStatisticsScan scan;\ntry {\n  scan = table.newPartitionStatisticsScan();\n} catch (UnsupportedOperationException e) {\n  scan = null; // table implementation does not expose partition statistics\n}","handlingStrategy":"try-catch","validationCode":"// before calling\nboolean supported = !(table instanceof MetadataTable) && !table.getClass().getSimpleName().contains(\"Serializable\");\nif (!supported) { skipPartitionStats(); }","typeGuard":"boolean supportsPartitionStatsScan(Table t) {\n  try { t.newPartitionStatisticsScan(); return true; }\n  catch (UnsupportedOperationException e) { return false; }\n}","tryCatchPattern":"try {\n  PartitionStatisticsScan scan = table.newPartitionStatisticsScan();\n  // use scan\n} catch (UnsupportedOperationException e) {\n  LOG.warn(\"Partition statistics scan unsupported for {}\", table.name());\n}","preventionTips":["Only call statistics APIs on the unwrapped data table, not on metadata tables or wrappers","Document that custom Table implementations must override newPartitionStatisticsScan()","Feature-detect once at startup and cache the capability flag per table"],"tags":["unsupported-operation","api-default-method","partition-statistics"],"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"}