{"record":{"id":"796bc14fd879343d","repo":"apache/iceberg","slug":"unsupported-type-map-796bc1","errorCode":null,"errorMessage":"Unsupported type - map","messagePattern":"Unsupported type - map","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/IcebergArrowColumnVector.java","lineNumber":128,"sourceCode":"    return accessor.getFloat(rowId);\n  }\n\n  @Override\n  public double getDouble(int rowId) {\n    return accessor.getDouble(rowId);\n  }\n\n  @Override\n  public ColumnarArray getArray(int rowId) {\n    if (isNullAt(rowId)) {\n      return null;\n    }\n    return accessor.getArray(rowId);\n  }\n\n  @Override\n  public ColumnarMap getMap(int rowId) {\n    throw new UnsupportedOperationException(\"Unsupported type - map\");\n  }\n\n  @Override\n  public Decimal getDecimal(int rowId, int precision, int scale) {\n    if (isNullAt(rowId)) {\n      return null;\n    }\n    return accessor.getDecimal(rowId, precision, scale);\n  }\n\n  @Override\n  public UTF8String getUTF8String(int rowId) {\n    if (isNullAt(rowId)) {\n      return null;\n    }\n    return accessor.getUTF8String(rowId);\n  }\n","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/IcebergArrowColumnVector.java#L110-L146","documentation":"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.","triggerScenarios":"A vectorized Iceberg scan in Spark 4.1 includes a column of Spark MapType and Spark invokes getMap(rowId) on the resulting IcebergArrowColumnVector.","commonSituations":"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.","solutions":["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","Rewrite the query to convert the map to a string/array (e.g. map_to_array, to_json) before the scan","Upgrade/check releases where map support in the Arrow vectorized reader is added"],"exampleFix":"// before\nspark.read.format(\"iceberg\").load(\"t\").select(\"map_col\")\n// after\ntbl.properties().put(\"read.vectorization.enabled\", \"false\")\nspark.read.format(\"iceberg\").load(\"t\").select(\"map_col\")","handlingStrategy":"validation","validationCode":"if (schema.fields().exists(_.dataType.isInstanceOf[MapType])) {\n  tbl.updateProperties().set(\"read.vectorization.enabled\", \"false\").commit()\n}","typeGuard":"def hasVectorizableSchema(schema: StructType): Boolean =\n  !schema.fields.exists(f => f.dataType.isInstanceOf[MapType] || f.dataType.isInstanceOf[ArrayType])","tryCatchPattern":"try {\n  df.select(\"map_col\").collect()\n} catch {\n  case e: UnsupportedOperationException if e.getMessage == \"Unsupported type - map\" =>\n    spark.read.format(\"iceberg\").option(\"vectorization-enabled\", \"false\").load(\"t\").select(\"map_col\").collect()\n}","preventionTips":["Disable vectorized reads for scans projecting map columns","Convert maps to strings/arrays at write time if they are frequently scanned","Check Iceberg release notes for map support in the Arrow vectorized reader"],"tags":["spark","arrow","vectorized-read","map-type"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}