apache/iceberg · error · java.lang.UnsupportedOperationException

Unsupported type - byte

Error message

Unsupported type - byte

What it means

IcebergArrowColumnVector adapts Arrow columnar data to Spark's ColumnVector interface for vectorized reads. Arrow has no byte-width buffer accessor mapped for getByte in this adapter, so it is intentionally unimplemented and throws UnsupportedOperationException — Spark columnar reads never use byte-level accessors for Iceberg data.

Source

Thrown at spark/v3.5/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. Avoid calling getByte on IcebergArrowColumnVector; read the value as int via getInt and narrow it
  2. Disable vectorization: spark.sql.iceberg.vectorization.enabled=false so non-Arrow column vectors are used
  3. Upgrade Iceberg in case a newer release added byte accessor support
  4. Cast the column to a wider type (e.g. IntegerType) in the query so byte access is not requested

Example fix

// before: custom accessor
byte b = vector.getByte(rowId); // throws
// after:
int v = vector.getInt(rowId); byte b = (byte) v; // or disable vectorization
Defensive patterns

Strategy: type-guard

Validate before calling

// Only call supported accessors on IcebergArrowColumnVector: getBoolean/getInt/getLong/getFloat/getDouble/getDecimal/getArray/getMap
boolean byteSafe(org.apache.spark.sql.vectorized.ColumnVector v) {
  return !(v instanceof org.apache.iceberg.spark.data.vectorized.IcebergArrowColumnVector);
}

Type guard

if (v instanceof org.apache.iceberg.spark.data.vectorized.IcebergArrowColumnVector) {
  int i = v.getInt(rowId); // never call getByte on Arrow-backed vectors
  byte b = (byte) i;
} else {
  byte b = v.getByte(rowId);
}

Prevention

When it happens

Trigger: Custom code (or a Spark internal path) calling getByte on an IcebergArrowColumnVector during a vectorized read. Standard Iceberg scans never trigger this; it appears only when a column accessor expects a ByteType-backed byte read directly from the Arrow-backed vector.

Common situations: Custom Spark TypeExtensions or third-party readers invoking the raw ColumnVector API; experimental Spark versions using byte accessors; user code extending the vectorized reader pipeline.

Related errors


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