apache/iceberg · error · UnsupportedOperationException
Unsupported task group for columnar reads: " +…
Error message
Unsupported task group for columnar reads: " + partition.taskGroup()
What it means
SparkColumnarReaderFactory.createColumnarReader throws UnsupportedOperationException when the input partition's task group is not composed entirely of FileScanTask, since columnar batch reading only handles file scan tasks.
Solutions
- Ensure the read uses batch FileScanTask-based scans, not changelog tasks
- Check supportColumnarReads gating — do not force columnar reads for such partitions
- Use the row/changelog reader path instead
- Align Iceberg versions if task types changed internally
Defensive patterns
Strategy: type-guard
Validate before calling
if (!partition.allTasksOfType(FileScanTask.class)) { /* use row-based/changelog reader instead */ } Type guard
boolean isColumnarReadable(SparkInputPartition p) { return p.allTasksOfType(FileScanTask.class); } Try / catch
try { createColumnarReader(partition); } catch (UnsupportedOperationException e) { /* fall back to row-based reader */ } Prevention
- Only enable columnar reads for pure file-scan task groups
- Respect supportColumnarReads gating in custom readers
When it happens
Trigger: A SparkInputPartition whose taskGroup contains non-FileScanTask tasks (e.g. changelog or metadata tasks) reaches createColumnarReader.
Common situations: Reading changelog/streaming scans columnar-ly; mixed task groups after internal scan changes; custom scan task types.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- Columnar reads are not supported
- Row-based reads are not supported
- ALTER VIEW AS is not supported. Use CREATE OR REPLACE VIEW…
- AS OF is not supported for changelogs
- Cannot add partition field to non-Iceberg table: $table
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/ced0cc11bff5d2bf.
Report an issue: GitHub.
Appendix: source
Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkColumnarReaderFactory.java:62
@Override
public PartitionReader<InternalRow> createReader(InputPartition inputPartition) {
throw new UnsupportedOperationException("Row-based reads are not supported");
}
@Override
public PartitionReader<ColumnarBatch> createColumnarReader(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 BatchDataReader(partition, parquetConf, orcConf);
} else {
throw new UnsupportedOperationException(
"Unsupported task group for columnar reads: " + partition.taskGroup());
}
}
@Override
public boolean supportColumnarReads(InputPartition inputPartition) {
return true;
}
}
View on GitHub (pinned to 86d9c8fc54)