{"record":{"id":"65240553c86159cd","repo":"apache/iceberg","slug":"unsupported-task-group-for-row-based-reads-part-652405","errorCode":null,"errorMessage":"Unsupported task group for row-based reads: + partition.taskGroup()","messagePattern":"Unsupported task group for row-based reads: \\+ partition\\.taskGroup\\(\\)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkRowReaderFactory.java","lineNumber":54,"sourceCode":"  public PartitionReader<InternalRow> createReader(InputPartition inputPartition) {\n    Preconditions.checkArgument(\n        inputPartition instanceof SparkInputPartition,\n        \"Unknown input partition type: %s\",\n        inputPartition.getClass().getName());\n\n    SparkInputPartition partition = (SparkInputPartition) inputPartition;\n\n    if (partition.allTasksOfType(FileScanTask.class)) {\n      return new RowDataReader(partition);\n\n    } else if (partition.allTasksOfType(ChangelogScanTask.class)) {\n      return new ChangelogRowReader(partition);\n\n    } else if (partition.allTasksOfType(PositionDeletesScanTask.class)) {\n      return new PositionDeletesRowReader(partition);\n\n    } else {\n      throw new UnsupportedOperationException(\n          \"Unsupported task group for row-based reads: \" + partition.taskGroup());\n    }\n  }\n\n  @Override\n  public PartitionReader<ColumnarBatch> createColumnarReader(InputPartition inputPartition) {\n    throw new UnsupportedOperationException(\"Columnar reads are not supported\");\n  }\n\n  @Override\n  public boolean supportColumnarReads(InputPartition inputPartition) {\n    return false;\n  }\n}\n","sourceCodeStart":36,"sourceCodeEnd":69,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkRowReaderFactory.java#L36-L69","documentation":"SparkRowReaderFactory only supports row-based reads for task groups composed entirely of ChangelogScanTask or PositionDeletesScanTask. When a partition's batch mixes task types (e.g. combined data/deletes tasks), no row reader implementation exists for it and this UnsupportedOperationException is thrown. It indicates the query plan produced a task grouping the row reader cannot handle.","triggerScenarios":"Calling SparkRowReaderFactory.createReader with an InputPartition whose task batch is neither all ChangelogScanTask nor all PositionDeletesScanTask (e.g. mixed ScanTask types in one partition).","commonSituations":"Streaming or incremental reads where the planning layer produces heterogeneous tasks; custom ScanTaskGroup implementations; internal Spark-Iceberg integration mismatches after version upgrades.","solutions":["Do not use the row reader factory for mixed task groups; use the batch/columnar SparkScan path instead","Check that the read is not accidentally routed through the changelog/deletes-only reader path","If the table mixes delete file types, normalize delete files (e.g. rewrite to position deletes) so tasks group uniformly","File a Spark-Iceberg integration issue if planning itself produced this mixed group"],"exampleFix":"// before (custom read path forcing row reads)\nPartitionReader<Record> reader = rowReaderFactory.createReader(partition);\n// after\nPartitionReader<ColumnarBatch> reader = batchReaderFactory.createColumnarReader(partition);","handlingStrategy":"validation","validationCode":"if (!(partition instanceof SparkInputPartition)) throw new IllegalArgumentException(\"unexpected partition type\");\nSparkInputPartition sp = (SparkInputPartition) partition;\nboolean ok = sp.taskGroup().tasks().stream().allMatch(t -> t instanceof ChangelogScanTask || t instanceof PositionDeletesScanTask);\nif (!ok) { /* route to batch/columnar reader path instead */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only wire SparkRowReaderFactory into scans guaranteed to produce homogeneous changelog or position-delete tasks","Route generic scans through the batch reader factory","Keep delete files homogeneous per table to avoid mixed task groups"],"tags":["unsupported-operation","spark","read-path"],"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"}