apache/iceberg · error · UnsupportedOperationException

Format: not supported for batched reads

Error message

Format:  not supported for batched reads

What it means

Thrown by ArrowReader.open when a FileScanTask's data file format is not Parquet, the only format the batched (vectorized) reader supports. ORC, Avro, and other formats have no Arrow RecordBatch read path, so the vectorized reader refuses them explicitly.

Source

Thrown at arrow/src/main/java/org/apache/iceberg/arrow/vectorized/ArrowReader.java:345

            FormatModelRegistry.readBuilder(FileFormat.PARQUET, ColumnarBatch.class, location);

        if (reuseContainers) {
          builder.reuseContainers();
        }
        if (nameMapping != null) {
          builder.withNameMapping(NameMappingParser.fromJson(nameMapping));
        }

        iter =
            builder
                .project(expectedSchema)
                .split(task.start(), task.length())
                .recordsPerBatch(batchSize)
                .caseSensitive(caseSensitive)
                .filter(task.residual())
                .build();
      } else {
        throw new UnsupportedOperationException(
            "Format: " + task.file().format() + " not supported for batched reads");
      }
      return iter.iterator();
    }

    @Override
    public void close() throws IOException {
      // close the current iterator
      this.currentIterator.close();

      // exhaust the task iterator
      while (fileItr.hasNext()) {
        fileItr.next();
      }
    }

    private InputFile getInputFile(FileScanTask task) {
      Preconditions.checkArgument(!task.isDataTask(), "Invalid task type");

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Rewrite the table data files to Parquet (e.g. rewrite_data_files procedure/action) so all tasks use the supported format.
  2. Disable vectorized/batched reads to fall back to the row-oriented reader that supports ORC/Avro.
  3. Set write.format.default=parquet for future writes and exclude non-Parquet files from vectorized scans.

Example fix

// before
conf.set("spark.sql.iceberg.vectorization.enabled", "true"); // table is ORC
// after
conf.set("spark.sql.iceberg.vectorization.enabled", "false");
// or rewrite: CALL catalog.system.rewrite_data_files(table => 'db.tbl')
Defensive patterns

Strategy: validation

Validate before calling

if (task.file().format() != FileFormat.PARQUET) {
  // route to row-based reader or rewrite file
}

Try / catch

try {
  return arrowReader.open(task);
} catch (UnsupportedOperationException e) {
  if (e.getMessage().contains("not supported for batched reads")) {
    return rowBasedReader.open(task);
  }
  throw e;
}

Prevention

When it happens

Trigger: Enabling batched/vectorized reads on a table containing ORC or Avro data files; mixed-format tables where some tasks point at non-Parquet files; writing data with write.format.default=orc/avro then reading with vectorization enabled.

Common situations: Tables migrated from other engines that use ORC; tables where format.default was changed to Avro; mixed-format tables after a format migration where old files remain.

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/39e4ba977568bf63. Report an issue: GitHub.