apache/iceberg · error · UnsupportedOperationException

Unsupported type - map

Error message

Unsupported type - map

What it means

Capability guard in IcebergArrowColumnVector.getMap (v4.1): the Arrow-backed vectorized accessor implements scalars and arrays but not maps, so reading a map value from a vectorized batch always throws. Map columns require the non-vectorized read path.

Source

Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/IcebergArrowColumnVector.java:128

    return accessor.getFloat(rowId);
  }

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

  @Override
  public ColumnarArray getArray(int rowId) {
    if (isNullAt(rowId)) {
      return null;
    }
    return accessor.getArray(rowId);
  }

  @Override
  public ColumnarMap getMap(int rowId) {
    throw new UnsupportedOperationException("Unsupported type - map");
  }

  @Override
  public Decimal getDecimal(int rowId, int precision, int scale) {
    if (isNullAt(rowId)) {
      return null;
    }
    return accessor.getDecimal(rowId, precision, scale);
  }

  @Override
  public UTF8String getUTF8String(int rowId) {
    if (isNullAt(rowId)) {
      return null;
    }
    return accessor.getUTF8String(rowId);
  }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Set read.vectorization.enabled=false on the table (or spark.sql.iceberg.vectorization.enabled in the session) so maps go through the row-based reader
  2. Rewrite the query to convert the map to a string/array (e.g. map_to_array, to_json) before the scan
  3. Upgrade/check releases where map support in the Arrow vectorized reader is added

Example fix

// before
spark.read.format("iceberg").load("t").select("map_col")
// after
tbl.properties().put("read.vectorization.enabled", "false")
spark.read.format("iceberg").load("t").select("map_col")
Defensive patterns

Strategy: validation

Validate before calling

if (schema.fields().exists(_.dataType.isInstanceOf[MapType])) {
  tbl.updateProperties().set("read.vectorization.enabled", "false").commit()
}

Type guard

def hasVectorizableSchema(schema: StructType): Boolean =
  !schema.fields.exists(f => f.dataType.isInstanceOf[MapType] || f.dataType.isInstanceOf[ArrayType])

Try / catch

try {
  df.select("map_col").collect()
} catch {
  case e: UnsupportedOperationException if e.getMessage == "Unsupported type - map" =>
    spark.read.format("iceberg").option("vectorization-enabled", "false").load("t").select("map_col").collect()
}

Prevention

When it happens

Trigger: A vectorized Iceberg scan in Spark 4.1 includes a column of Spark MapType and Spark invokes getMap(rowId) on the resulting IcebergArrowColumnVector.

Common situations: Selecting map columns from an Iceberg table with vectorized reads enabled; Spark plans that keep map columns in the columnar batch instead of falling back to row-based reads.

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


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