{"record":{"id":"318e8048eb04b274","repo":"apache/iceberg","slug":"class-does-not-implement-getmap","errorCode":null,"errorMessage":"${class} does not implement getMap","messagePattern":"(.+?) does not implement getMap","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ConstantColumnVector.java","lineNumber":107,"sourceCode":"\n  @Override\n  public float getFloat(int rowId) {\n    return (float) constant;\n  }\n\n  @Override\n  public double getDouble(int rowId) {\n    return (double) constant;\n  }\n\n  @Override\n  public ColumnarArray getArray(int rowId) {\n    throw new UnsupportedOperationException(this.getClass() + \" does not implement getArray\");\n  }\n\n  @Override\n  public ColumnarMap getMap(int ordinal) {\n    throw new UnsupportedOperationException(this.getClass() + \" does not implement getMap\");\n  }\n\n  @Override\n  public Decimal getDecimal(int rowId, int precision, int scale) {\n    return (Decimal) constant;\n  }\n\n  @Override\n  public UTF8String getUTF8String(int rowId) {\n    return (UTF8String) constant;\n  }\n\n  @Override\n  public byte[] getBinary(int rowId) {\n    return (byte[]) constant;\n  }\n\n  @Override","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ConstantColumnVector.java#L89-L125","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nspark.read.format(\"iceberg\").load(\"t\").select(\"map_partition_col\")\n// after\ntbl.properties().put(\"read.vectorization.enabled\", \"false\")\nspark.read.format(\"iceberg\").load(\"t\").select(\"map_partition_col\")","handlingStrategy":"validation","validationCode":"import org.apache.iceberg.types.Types;\nimport org.apache.iceberg.types.Type;\nif (columnType.typeId() == Type.TypeID.MAP) {\n  throw new IllegalStateException(\n    \"Map-typed constant columns are not supported by vectorized reads; disable vectorization\");\n}","typeGuard":"boolean isVectorizable(Type t) {\n  return t.typeId() != Type.TypeID.MAP && t.typeId() != Type.TypeID.STRUCT;\n}","tryCatchPattern":"try {\n  df.select(\"map_partition_col\").collect();\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"does not implement getMap\")) {\n    // retry with vectorization disabled\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["spark","vectorized-read","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}