apache/iceberg · error · java.lang.UnsupportedOperationException
${this.getClass()} does not implement getArray
Error message
${this.getClass()} does not implement getArray What it means
ConstantColumnVector is a Spark columnar vector that returns a single constant value for every row (used for metadata/constant-folded columns in vectorized reads). It implements scalar accessors (getBoolean, getInt, getDouble, getDecimal) but deliberately does not implement getArray, since a constant value cannot be an array in this design; calling getArray throws UnsupportedOperationException.
Source
Thrown at spark/v3.5/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;
}
@OverrideView on GitHub (pinned to 86d9c8fc54)
Solutions
- Avoid projecting array-typed constants/metadata columns in vectorized reads; compute them outside the scan (e.g. with a post-scan select)
- Disable vectorization: spark.sql.iceberg.vectorization.enabled=false
- Upgrade Iceberg — newer versions may support constant arrays in vectorized reads
- Restructure the query so the array column comes from actual data files rather than a constant source
Example fix
// before: SELECT array(1,2) AS a, * FROM iceberg_table (constant array hits vectorized scan)
// after:
val df = spark.read.format("iceberg").load("db.table")
df.withColumn("a", array(lit(1), lit(2))) // constant added after the scan Defensive patterns
Strategy: try-catch
Validate before calling
// Avoid array-typed constants/metadata columns in vectorized scans: // if the projection includes a literal array, apply it after the read instead
Try / catch
try {
df.collect();
} catch (UnsupportedOperationException e) {
if (e.getMessage().endsWith("does not implement getArray")) {
// recompute the array column post-scan or disable vectorization
} else throw e;
} Prevention
- Don't project array/map literals together with vectorized Iceberg scans; add them after the read
- Keep constant-foldable expressions out of scan projections
- Test vectorized reads (vectorization.enabled=true) with your full projection list
When it happens
Trigger: A vectorized Spark read where a query invokes getArray on a column that was materialized as a ConstantColumnVector — e.g. a constant-folded expression or metadata column whose Spark type is an array type.
Common situations: Selecting an array-typed constant or metadata column (e.g. via metadata column projection or partition transforms producing constant arrays); Spark optimizer folding a literal array column into the constant vector path.
Related errors
- Unknown dummy vector holder: ${holder}
- ${this.getClass()} does not implement getMap
- Unsupported type - byte
- Unknown dummy vector holder: ${holder}
- ${class} does not implement getArray
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/b13e18ee78027b61.
Report an issue: GitHub.