{"record":{"id":"bd36f116f5426b3e","repo":"apache/iceberg","slug":"incremental-scan-is-not-supported","errorCode":null,"errorMessage":"Incremental scan is not supported","messagePattern":"Incremental scan is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"api/src/main/java/org/apache/iceberg/TableScan.java","lineNumber":77,"sourceCode":"   * @throws IllegalArgumentException if the snapshot cannot be found or time travel is attempted on\n   *     a tag\n   */\n  TableScan asOfTime(long timestampMillis);\n\n  /**\n   * Create a new {@link TableScan} to read appended data from {@code fromSnapshotId} exclusive to\n   * {@code toSnapshotId} inclusive.\n   *\n   * @param fromSnapshotId the last snapshot id read by the user, exclusive\n   * @param toSnapshotId read append data up to this snapshot id\n   * @return a table scan which can read append data from {@code fromSnapshotId} exclusive and up to\n   *     {@code toSnapshotId} inclusive\n   * @deprecated since 1.0.0, will be removed in 2.0.0; use {@link Table#newIncrementalAppendScan()}\n   *     instead.\n   */\n  @Deprecated\n  default TableScan appendsBetween(long fromSnapshotId, long toSnapshotId) {\n    throw new UnsupportedOperationException(\"Incremental scan is not supported\");\n  }\n\n  /**\n   * Create a new {@link TableScan} to read appended data from {@code fromSnapshotId} exclusive to\n   * the current snapshot inclusive.\n   *\n   * @param fromSnapshotId - the last snapshot id read by the user, exclusive\n   * @return a table scan which can read append data from {@code fromSnapshotId} exclusive and up to\n   *     current snapshot inclusive\n   * @deprecated since 1.0.0, will be removed in 2.0.0; use {@link Table#newIncrementalAppendScan()}\n   *     instead.\n   */\n  @Deprecated\n  default TableScan appendsAfter(long fromSnapshotId) {\n    throw new UnsupportedOperationException(\"Incremental scan is not supported\");\n  }\n\n  /**","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/TableScan.java#L59-L95","documentation":"The deprecated default TableScan.appendsBetween(long, long) throws UnsupportedOperationException because incremental append scans are not implemented by every TableScan implementation. It is scheduled for removal in 2.0.0 in favor of Table.newIncrementalAppendScan(); the throwing default documents that this scan implementation cannot do incremental scans.","triggerScenarios":"Calling scan.appendsBetween(fromSnapshotId, toSnapshotId) — e.g. from snapshotToDataFiles-style incremental replication logic — on a TableScan implementation that does not override appendsBetween.","commonSituations":"Incremental ingest/replication pipelines written before 1.0.0 still using the deprecated API; running incremental scans against non-standard TableScan implementations or metadata tables.","solutions":["Migrate to table.newIncrementalAppendScan().appendsBetween(fromSnapshotId, toSnapshotId) as the deprecation instructs.","Use the current API: IncrementalAppendScan obtained from the Table, which all modern tables support.","Catch UnsupportedOperationException during the migration window if some scans cannot do incremental reads.","Remove reliance on the deprecated method before upgrading to Iceberg 2.0.0."],"exampleFix":"// before\nTableScan scan = table.newScan().appendsBetween(fromId, toId);\n\n// after\nTableScan scan =\n    ((IncrementalAppendScan) table.newIncrementalAppendScan())\n        .appendsBetween(fromId, toId);","handlingStrategy":"fallback","validationCode":"// use the non-deprecated API path\norg.apache.iceberg.IncrementalAppendScan incr =\n    (org.apache.iceberg.IncrementalAppendScan) table.newIncrementalAppendScan();\nTableScan scan = (TableScan) incr.appendsBetween(fromId, toId);","typeGuard":"TableScan incrementalBetween(Table t, long fromId, long toId) {\n  return (TableScan) ((org.apache.iceberg.IncrementalAppendScan) t.newIncrementalAppendScan())\n      .appendsBetween(fromId, toId);\n}","tryCatchPattern":"TableScan scan;\ntry {\n  scan = table.newScan().appendsBetween(fromId, toId);\n} catch (UnsupportedOperationException e) {\n  scan = (TableScan) ((org.apache.iceberg.IncrementalAppendScan)\n      table.newIncrementalAppendScan()).appendsBetween(fromId, toId);\n}","preventionTips":["Stop using the deprecated TableScan.appendsBetween; switch to Table.newIncrementalAppendScan()","Audit pipelines for APIs marked '@deprecated since 1.0.0, will be removed in 2.0.0'","Run incremental ingestion tests after Iceberg upgrades to catch removed methods"],"tags":["unsupported-operation","deprecated-api","incremental-scan"],"backgroundTag":"deprecated-api-usage","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"}