apache/iceberg · error · UnsupportedOperationException
does not implement getMap
Error message
${class} does not implement getMap What it means
ConstantColumnVector supplies a single constant value for every row (used for constant folding / partition values in vectorized reads). It only implements the accessors for the scalar types it supports; getMap is deliberately unimplemented, so reading a map-typed constant column throws UnsupportedOperationException.
Solutions
- Avoid projecting map-typed constants through the vectorized path (e.g. rewrite the query to cast the constant or disable vectorized reads for that scan)
- Set spark.sql.iceberg.handle-timestamp-without-timezone / vectorization settings or set read.vectorization.enabled=false on the table to fall back to the row-based reader
- Extend ConstantColumnVector to return a constant ColumnarMap if this type combination is needed upstream
Example fix
// before
spark.read.format("iceberg").load("t").select("map_partition_col")
// after
tbl.properties().put("read.vectorization.enabled", "false")
spark.read.format("iceberg").load("t").select("map_partition_col") Defensive patterns
Strategy: validation
Validate before calling
import org.apache.iceberg.types.Types;
import org.apache.iceberg.types.Type;
if (columnType.typeId() == Type.TypeID.MAP) {
throw new IllegalStateException(
"Map-typed constant columns are not supported by vectorized reads; disable vectorization");
} Type guard
boolean isVectorizable(Type t) {
return t.typeId() != Type.TypeID.MAP && t.typeId() != Type.TypeID.STRUCT;
} Try / catch
try {
df.select("map_partition_col").collect();
} catch (UnsupportedOperationException e) {
if (e.getMessage() != null && e.getMessage().contains("does not implement getMap")) {
// retry with vectorization disabled
}
throw e;
} Prevention
- Check partition/constant column types before relying on vectorized reads
- Set read.vectorization.enabled=false for tables with map-valued partition columns
- Pin a Spark/Iceberg combination known to handle the projection
When it happens
Trigger: A vectorized Spark read resolves a map-typed column to a constant value (e.g. a static partition column of map type, or a constant-folded expression producing a map) and Spark calls ColumnVector.getMap(rowId) on the ConstantColumnVector.
Common situations: Querying a table with a static partition column whose partition value type is a map, or a constant projection of a map literal, while using the vectorized reader in Spark 4.1.
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
- Altering a view is not supported by catalog:
- Altering a view is not supported by catalog
- Altering a view is not supported by catalog
- Altering a view is not supported by catalog
- Altering a view is not supported by catalog: catalogName
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/318e8048eb04b274.
Report an issue: GitHub.
Appendix: source
Thrown at spark/v4.1/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)