apache/iceberg · error · UnsupportedOperationException
does not implement getMap
Error message
${this.getClass()} does not implement getMap What it means
ConstantColumnVector stores a single repeated constant value and implements only scalar accessors. getMap is intentionally unimplemented and always throws UnsupportedOperationException, because a constant value cannot be a map. Spark calls getMap when the reader expects a map-typed column but the vector is a constant vector.
Solutions
- Check the partition spec / projection for a map-typed constant field and change the table design (partition by a scalar key instead of the map).
- Turn off vectorized reads (read.vectorization.enabled=false) to bypass ConstantColumnVector and use the row-based reader.
- If support is genuinely needed, implement getMap in ConstantColumnVector returning a constant ColumnarMap.
- Upgrade Iceberg to a release where this path is guarded or supported.
Defensive patterns
Strategy: validation
Validate before calling
if (vector instanceof ConstantColumnVector && expectedType instanceof MapType) {
throw new IllegalStateException("Constant projection cannot yield a map column");
} Type guard
boolean supportsMaps(ColumnVector v) { return !(v instanceof ConstantColumnVector); } Try / catch
try { vector.getMap(rowId); } catch (UnsupportedOperationException e) {
// re-read column via non-vectorized path
} Prevention
- Partition only by scalar-typed columns, never map or array.
- Disable vectorization for queries that project map columns from constant expressions.
When it happens
Trigger: Reading a map-typed column that the scan resolved to a constant vector — e.g. a map-typed partition column, a constant-folded expression returning a map, or metadata column projection producing a constant map.
Common situations: Map-typed partition fields in the table spec (unsupported for constant projection); queries referencing map columns under predicates that Iceberg constant-folds; version mismatches where Spark's vectorized reader assumes map support.
Related errors
- does not implement getArray
- Unhandled type
- Unsupported type - byte
- Unsupported type - byte
- Unsupported type - short
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/395284f4045360e0.
Report an issue: GitHub.
Appendix: source
Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ConstantColumnVector.java:107
@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
public byte[] getBinary(int rowId) {
return (byte[]) constant;
}
@OverrideView on GitHub (pinned to 86d9c8fc54)