apache/iceberg · error · UnsupportedOperationException

does not implement getMap

Error message

 does not implement getMap

What it means

Capability guard in ConstantColumnVector.getMap: this vector returns a single constant for every row and only implements scalar accessors; array and map access are unimplemented and throw with the class name in the message. It fires only if the constant column is typed as a map and Spark reads it as such.

Solutions

  1. Disable vectorized reads for the scan (read.split.vectorization.enabled=false)
  2. Avoid map-typed constant substitution — rewrite the delete/filter to not use map constants
  3. Upgrade Iceberg to a version with broader ConstantColumnVector support
  4. Restructure schema so map columns are not targeted by constant-value deletes

Example fix

// before
spark.read.format("iceberg").load("t").select("map_col") // with constant map
// after
spark.conf.set("read.split.vectorization.enabled", "false") // then re-run the same query
Defensive patterns

Strategy: validation

Validate before calling

if (vector instanceof ConstantColumnVector && expectedType instanceof MapType) { useNonVectorizedRead(); }

Type guard

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

Try / catch

try { map = vector.getMap(ordinal); } catch (UnsupportedOperationException e) { // re-run non-vectorized }
spark.conf.set("read.split.vectorization.enabled", "false");

Prevention

When it happens

Trigger: A vectorized read calls getMap(ordinal) on a column whose values were replaced by a constant (e.g. via equality deletes or constant folding) where the constant is or the column is map-typed.

Common situations: Equality deletes that target or substitute map columns with vectorized reads enabled; batch scans containing map columns resolved to ConstantColumnVector.

Related errors


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

Appendix: source

Thrown at spark/v4.0/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;
  }

  @Override

View on GitHub (pinned to 86d9c8fc54)