apache/iceberg · error · UnsupportedOperationException

does not implement getArray

Error message

${this.getClass()} does not implement getArray

What it means

ConstantColumnVector represents a column where every row holds the same constant value (typically from a constant projection like partition values or residual filters). It only implements scalar accessors (getBoolean, getInt, getDouble, getDecimal...); getArray is intentionally not implemented and always throws UnsupportedOperationException, since a constant value can never be an array.

Solutions

  1. Re-examine the query/schema: an array column should never be constant-projected; check whether the partition spec contains an array-typed partition field (unsupported) and remove or change it.
  2. Disable vectorized reads for the query (read.vectorization.enabled=false) so the non-vectorized path materializes the constant value instead.
  3. If this is a legitimate new requirement, implement getArray in ConstantColumnVector to return a ColumnarArray filled with the constant value.
  4. Upgrade Iceberg/Spark to a version where the constant-projection path for this type is handled.
Defensive patterns

Strategy: validation

Validate before calling

if (vector instanceof ConstantColumnVector && expectedType instanceof ArrayType) {
  throw new IllegalStateException("Constant projection cannot yield an array column");
}

Type guard

boolean supportsArrays(ColumnVector v) { return !(v instanceof ConstantColumnVector); }

Try / catch

try { vector.getArray(rowId); } catch (UnsupportedOperationException e) {
  // fall back to non-vectorized read for this column
}

Prevention

When it happens

Trigger: Spark calls getArray(rowId) on a vector produced by ConstantColumnVector — i.e., a query reads an array column that the scan resolved to a constant projection (e.g. a partition column typed as a list, or a constant-folded expression producing an array).

Common situations: Querying a list/array-typed column that comes from constant folding or partition-value projection; using Iceberg expressions that constant-fold into array types; Spark's vectorized reader accessing array elements on a constant vector.

Related errors


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

Appendix: source

Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ConstantColumnVector.java:102

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

  @Override
  public float getFloat(int rowId) {
    return (float) constant;
  }

  @Override
  public double getDouble(int rowId) {
    return (double) constant;
  }

  @Override
  public ColumnarArray getArray(int rowId) {
    throw new UnsupportedOperationException(this.getClass() + " does not implement getArray");
  }

  @Override
  public ColumnarMap getMap(int ordinal) {
    throw new UnsupportedOperationException(this.getClass() + " does not implement getMap");
  }

  @Override
  public Decimal getDecimal(int rowId, int precision, int scale) {
    return (Decimal) constant;
  }

  @Override
  public UTF8String getUTF8String(int rowId) {
    return (UTF8String) constant;
  }

  @Override

View on GitHub (pinned to 86d9c8fc54)