apache/iceberg · error · UnsupportedOperationException

Unsupported task group for row-based reads: ${partition.task

Error message

Unsupported task group for row-based reads: ${partition.taskGroup()}

What it means

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.

Source

Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkRowReaderFactory.java:54

  public PartitionReader<InternalRow> createReader(InputPartition inputPartition) {
    Preconditions.checkArgument(
        inputPartition instanceof SparkInputPartition,
        "Unknown input partition type: %s",
        inputPartition.getClass().getName());

    SparkInputPartition partition = (SparkInputPartition) inputPartition;

    if (partition.allTasksOfType(FileScanTask.class)) {
      return new RowDataReader(partition);

    } else if (partition.allTasksOfType(ChangelogScanTask.class)) {
      return new ChangelogRowReader(partition);

    } else if (partition.allTasksOfType(PositionDeletesScanTask.class)) {
      return new PositionDeletesRowReader(partition);

    } else {
      throw new UnsupportedOperationException(
          "Unsupported task group for row-based reads: " + partition.taskGroup());
    }
  }

  @Override
  public PartitionReader<ColumnarBatch> createColumnarReader(InputPartition inputPartition) {
    throw new UnsupportedOperationException("Columnar reads are not supported");
  }

  @Override
  public boolean supportColumnarReads(InputPartition inputPartition) {
    return false;
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Align Iceberg core and spark module versions so task types and reader factories match.
  2. Ensure scan planning produces homogeneous task groups per partition (don't mix task types).
  3. Extend createReader to add a row reader for the new task type if maintaining a fork.
Defensive patterns

Strategy: validation

Validate before calling

if (!(partition instanceof SparkInputPartition)) return;
List<ScanTaskGroup> groups = ((SparkInputPartition) partition).taskGroups();
// ensure homogeneous, supported task types before requesting a row reader

Try / catch

try {
  return factory.createReader(partition);
} catch (UnsupportedOperationException e) {
  throw new IllegalStateException("Task group unsupported for row reads; check Iceberg version alignment", e);
}

Prevention

When it happens

Trigger: 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.

Common situations: Version mismatch where a newer Iceberg planner produces task types an older Spark reader factory cannot read; custom scan planning producing heterogeneous task groups.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/703e1a8e34ed1fdb. Report an issue: GitHub.