{"record":{"id":"703e1a8e34ed1fdb","repo":"apache/iceberg","slug":"unsupported-task-group-for-row-based-reads-part","errorCode":null,"errorMessage":"Unsupported task group for row-based reads: ${partition.taskGroup()}","messagePattern":"Unsupported task group for row-based reads: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v3.5/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/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkRowReaderFactory.java#L36-L69","documentation":"SparkRowReaderFactory.createReader() supports row reads over standard file tasks, changelog tasks, and PositionDeletesScanTask groups. If the InputPartition's task group contains any other (or mixed) task types, it throws UnsupportedOperationException because no row reader exists for it.","triggerScenarios":"A SparkScan partition whose taskGroup() is neither GenericFileScanTask group, ChangelogScanTask group, nor all PositionDeletesScanTask — e.g. mixed task types in one partition, or new task types (DV/metadata task variants) fed to a factory that doesn't handle them.","commonSituations":"Version mismatch where a newer Iceberg planner produces task types an older Spark reader factory cannot read; custom scan planning producing heterogeneous task groups.","solutions":["Align Iceberg core and spark module versions so task types and reader factories match.","Ensure scan planning produces homogeneous task groups per partition (don't mix task types).","Extend createReader to add a row reader for the new task type if maintaining a fork."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!(partition instanceof SparkInputPartition)) return;\nList<ScanTaskGroup> groups = ((SparkInputPartition) partition).taskGroups();\n// ensure homogeneous, supported task types before requesting a row reader","typeGuard":null,"tryCatchPattern":"try {\n  return factory.createReader(partition);\n} catch (UnsupportedOperationException e) {\n  throw new IllegalStateException(\"Task group unsupported for row reads; check Iceberg version alignment\", e);\n}","preventionTips":["Keep spark and core Iceberg modules from the same release.","Do not mix task types within a single scan task group.","Test custom scan planning against the bundled reader factories."],"tags":["spark","scan-planning","unsupported-operation"],"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"}