apache/iceberg · error · UnsupportedOperationException

Unsupported type - byte

Error message

Unsupported type - byte

What it means

IcebergArrowColumnVector exposes Arrow accessors to Spark's columnar API. The Arrow-backed vectors produced here never carry byte-typed data, so getByte() is intentionally unimplemented and always throws UnsupportedOperationException.

Source

Thrown at spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/IcebergArrowColumnVector.java:90

  @Override
  public int numNulls() {
    return nullabilityHolder.numNulls();
  }

  @Override
  public boolean isNullAt(int rowId) {
    return nullabilityHolder.isNullAt(rowId) == 1;
  }

  @Override
  public boolean getBoolean(int rowId) {
    return accessor.getBoolean(rowId);
  }

  @Override
  public byte getByte(int rowId) {
    throw new UnsupportedOperationException("Unsupported type - byte");
  }

  @Override
  public short getShort(int rowId) {
    throw new UnsupportedOperationException("Unsupported type - short");
  }

  @Override
  public int getInt(int rowId) {
    return accessor.getInt(rowId);
  }

  @Override
  public long getLong(int rowId) {
    return accessor.getLong(rowId);
  }

  @Override

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Read the column as IntegerType and cast to byte in Spark after the scan
  2. Disable vectorized reads (spark.read.option or read.split.vectorization.enabled=false)
  3. Change the table schema to avoid byte-width columns if possible
  4. Upgrade Iceberg in case byte accessor support was added

Example fix

// before
val df = spark.read.format("iceberg").load("t") // tinyint column read vectorized
// after
spark.conf.set("read.split.vectorization.enabled", "false")
val df = spark.read.format("iceberg").load("t").col("c").cast("byte")
Defensive patterns

Strategy: type-guard

Validate before calling

if (schema.fields().anyMatch(f -> f.dataType() == ByteType)) { spark.conf.set("read.split.vectorization.enabled", "false"); }

Type guard

boolean byteSafe(ColumnVector v) { return !(v instanceof IcebergArrowColumnVector); }

Try / catch

try { b = vector.getByte(rowId); } catch (UnsupportedOperationException e) { int widened = vector.getInt(rowId); b = (byte) widened; }

Prevention

When it happens

Trigger: Spark calls getByte(rowId) on an Arrow-backed vector, which happens when a batch column's Spark type is ByteType while the reader does not produce byte accessors.

Common situations: Reading a table with a Spark ByteType-mapped column (Iceberg Integer with byte upcast, or a Spark-side cast to byte) under vectorized read.

Related errors


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