{"record":{"id":"018c0eb21f433690","repo":"apache/beam","slug":"batch-scan-not-supported","errorCode":null,"errorMessage":"BATCH scan not supported","messagePattern":"BATCH scan not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/ScanSource.java","lineNumber":99,"sourceCode":"\n    switch (scanConfig.getScanType()) {\n      case TABLE:\n        TableScan tableScan = getTableScan();\n        if (desiredBundleSizeBytes > 0) {\n          tableScan =\n              tableScan.option(TableProperties.SPLIT_SIZE, Long.toString(desiredBundleSizeBytes));\n        }\n\n        try (CloseableIterable<CombinedScanTask> tasks = tableScan.planTasks()) {\n          for (CombinedScanTask combinedScanTask : tasks) {\n            splits.add(new ScanTaskSource(scanConfig, combinedScanTask));\n          }\n        } catch (IOException e) {\n          throw new RuntimeException(e);\n        }\n        break;\n      case BATCH:\n        throw new UnsupportedOperationException(\"BATCH scan not supported\");\n      default:\n        throw new UnsupportedOperationException(\"Unknown scan type: \" + scanConfig.getScanType());\n    }\n\n    return splits;\n  }\n\n  @Override\n  public long getEstimatedSizeBytes(PipelineOptions options) throws Exception {\n    return wholeTableReadTask().sizeBytes();\n  }\n\n  @Override\n  public void populateDisplayData(DisplayData.Builder builder) {\n    super.populateDisplayData(builder);\n  }\n\n  @Override","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/ScanSource.java#L81-L117","documentation":"Beam's Iceberg ScanSource.split() only supports Iceberg TABLE (and presumably INCREMENTAL) scan types; a BATCH scan configuration is rejected with UnsupportedOperationException. BATCH scans (the Iceberg BatchScan API) are not implemented in this connector. This is a hard capability limit, not a transient error.","triggerScenarios":"A ScanConfig with scanType == BATCH is passed to ScanSource.split() when Beam tries to split the source into bundles, typically when constructing a BoundedSource from a table-scanned batch scan.","commonSituations":"Using Iceberg's batch scan API results directly with the Beam connector; wiring a custom scan config with ScanType.BATCH; running an unbounded/streaming read path that maps to BATCH scans.","solutions":["Use a TABLE (or incremental) scan configuration instead of BATCH when building the Beam source.","Do your BATCH scan outside Beam (directly via Iceberg's Table.scan().planFiles()) if you don't need Beam splitting.","If you own the code, implement the BATCH case or convert the batch scan into a TABLE scan task list before creating the source."],"exampleFix":"// before\nScanConfig cfg = ScanConfig.builder().setScanType(ScanType.BATCH).build();\n// after\nScanConfig cfg = ScanConfig.builder().setScanType(ScanType.TABLE).build();","handlingStrategy":"validation","validationCode":"if (scanConfig.getScanType() == ScanType.BATCH) {\n  throw new IllegalArgumentException(\"BATCH scans are unsupported by Beam's Iceberg ScanSource; use TABLE scans\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  return source.split(desiredBundles, pipelineOptions);\n} catch (UnsupportedOperationException e) {\n  // fall back to a TABLE-scan based source\n  throw new IllegalStateException(\"Reconfigure scan to TABLE type; BATCH unsupported\", e);\n}","preventionTips":["Always set scanType explicitly (TABLE) when constructing ScanConfig for Beam reads.","Do not feed raw Iceberg batch scan results into Beam sources.","Add an assertion in pipeline construction code that rejects BATCH scans early."],"tags":["iceberg","java","apache-beam","unsupported-scan-type"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}