{"record":{"id":"395284f4045360e0","repo":"apache/iceberg","slug":"this-getclass-does-not-implement-getmap-395284","errorCode":null,"errorMessage":"${this.getClass()} does not implement getMap","messagePattern":"(.+?) does not implement getMap","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/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.2/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ConstantColumnVector.java#L89-L125","documentation":"ConstantColumnVector stores a single repeated constant value and implements only scalar accessors. getMap is intentionally unimplemented and always throws UnsupportedOperationException, because a constant value cannot be a map. Spark calls getMap when the reader expects a map-typed column but the vector is a constant vector.","triggerScenarios":"Reading a map-typed column that the scan resolved to a constant vector — e.g. a map-typed partition column, a constant-folded expression returning a map, or metadata column projection producing a constant map.","commonSituations":"Map-typed partition fields in the table spec (unsupported for constant projection); queries referencing map columns under predicates that Iceberg constant-folds; version mismatches where Spark's vectorized reader assumes map support.","solutions":["Check the partition spec / projection for a map-typed constant field and change the table design (partition by a scalar key instead of the map).","Turn off vectorized reads (read.vectorization.enabled=false) to bypass ConstantColumnVector and use the row-based reader.","If support is genuinely needed, implement getMap in ConstantColumnVector returning a constant ColumnarMap.","Upgrade Iceberg to a release where this path is guarded or supported."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (vector instanceof ConstantColumnVector && expectedType instanceof MapType) {\n  throw new IllegalStateException(\"Constant projection cannot yield a map column\");\n}","typeGuard":"boolean supportsMaps(ColumnVector v) { return !(v instanceof ConstantColumnVector); }","tryCatchPattern":"try { vector.getMap(rowId); } catch (UnsupportedOperationException e) {\n  // re-read column via non-vectorized path\n}","preventionTips":["Partition only by scalar-typed columns, never map or array.","Disable vectorization for queries that project map columns from constant expressions."],"tags":["spark","vectorized-read","constant-projection","unsupported-type"],"backgroundTag":"method-not-implemented","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"}