apache/iceberg · error · java.lang.UnsupportedOperationException

Unsupported type - short

Error message

Unsupported type - short

What it means

Iceberg's Arrow-backed column vector for Spark's vectorized reader does not implement getShort for the underlying accessor. Any code path that reads a short column value row-wise throws UnsupportedOperationException. Shorts must be read via getInt (upcast) by the caller.

Solutions

  1. Read the value with getInt(rowId) instead and cast to short: (short) vec.getInt(rowId)
  2. Disable vectorized reads for the scan (set read.arrow.vectorized or spark.sql.iceberg.vectorized-enabled=false) so rows are read via the non-vectorized path
  3. If this occurs inside Spark internals, check whether the Spark expression supports columnar execution and mark the column/expr non-columnar or upgrade Iceberg/Spark versions

Example fix

// before
short v = vec.getShort(rowId);
// after
short v = (short) vec.getInt(rowId);
Defensive patterns

Strategy: try-catch

Validate before calling

// Check the vector type before row access
if (vector.dataType() == DataTypes.ShortType) {
  int v = ((IcebergArrowColumnVector) vector).getInt(rowId); // shorts are exposed as ints
}

Type guard

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

Try / catch

try {
  s = vec.getShort(rowId);
} catch (UnsupportedOperationException e) {
  s = (short) vec.getInt(rowId);
}

Prevention

When it happens

Trigger: Calling IcebergShortColumnVector.getShort(rowId) on a vectorized batch read of a Spark ShortType/iceberg int-with-short-source column; typically triggered inside Spark's ColumnarBatch row access when an expression requests a short primitive directly.

Common situations: Custom Spark expressions or UDFs consuming a columnar batch that call getShort; Spark code paths (e.g. certain cast/aggregate operators) that assume short column vectors support getShort, while Iceberg only exposes the value as an int accessor.

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

Appendix: source

Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/IcebergArrowColumnVector.java:95

  @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
  public float getFloat(int rowId) {
    return accessor.getFloat(rowId);
  }

  @Override

View on GitHub (pinned to 86d9c8fc54)