apache/iceberg · error · UnsupportedOperationException

Columnar reads are not supported

Error message

Columnar reads are not supported

What it means

This reader factory is used only for row-based reads (position deletes, changelogs); columnar batch reads are intentionally not implemented. createColumnarReader() unconditionally throws UnsupportedOperationException, and supportColumnarReads() reports false so Spark should never batch-read through it.

Solutions

  1. Do not request columnar reads for these scans; use row-based reads (supportColumnarReads is false by design).
  2. Remove overrides that force columnar batch reading for Iceberg row-reader scans.
  3. If columnar reads are needed, use a different scan/source that supports batches instead of SparkRowReaderFactory.

Example fix

// before
spark.conf.set("spark.sql.sources.useV1Reader", "v1") // forces columnar path assumptions

// after
// use the default reader path; batch reads are unsupported for these scans
Defensive patterns

Strategy: type-guard

Validate before calling

if (!readerFactory.supportColumnarReads(inputPartition)) {
  reader = readerFactory.createReader(inputPartition);
} else {
  reader = readerFactory.createColumnarReader(inputPartition);
}

Type guard

boolean supportsBatches = readerFactory.supportColumnarReads(partition); // always false here
assert !supportsBatches : "columnar reads unsupported for this factory";

Try / catch

try {
  reader = readerFactory.createColumnarReader(partition);
} catch (UnsupportedOperationException e) {
  reader = readerFactory.createReader(partition); // row-based fallback
}

Prevention

When it happens

Trigger: Spark requests a columnar reader (PartitionReader<ColumnarBatch>) from this factory — normally only possible if Spark ignores supportColumnarReads()==false or a custom reader is registered for the wrong scan type.

Common situations: Custom Spark integrations or spark.sql.sources.useV1Reader-style misconfiguration forcing columnar reads on a position-deletes/changelog scan.

Related errors


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

Appendix: source

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

    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)