{"record":{"id":"84298f38e8db5644","repo":"apache/iceberg","slug":"this-getclass-does-not-implement-getmap","errorCode":null,"errorMessage":"${this.getClass()} does not implement getMap","messagePattern":"(.+?) does not implement getMap","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v3.5/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/v3.5/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ConstantColumnVector.java#L89-L125","documentation":"ConstantColumnVector (vectorized Spark reads) returns one constant value for all rows and implements only scalar accessors plus getDecimal; getMap is intentionally not implemented, so calling it throws UnsupportedOperationException. A map-valued constant column cannot be represented by this vector.","triggerScenarios":"A vectorized Spark read where Spark calls getMap on a column materialized as ConstantColumnVector — e.g. a constant-folded map literal or a map-typed metadata column pushed into the constant vector path.","commonSituations":"Queries projecting map-typed literals or constant map columns alongside an Iceberg scan with vectorization enabled; optimizer folding map expressions into the scan's constant columns.","solutions":["Move map-typed constant projections out of the scan (apply withColumn after reading the table)","Disable vectorized reads: spark.sql.iceberg.vectorization.enabled=false","Upgrade the Iceberg runtime to a version with broader constant-vector support","Rewrite the query so the map column originates from data files, not a constant"],"exampleFix":"// before: SELECT map('k',1) AS m, * FROM iceberg_table\n// after:\nval df = spark.read.format(\"iceberg\").load(\"db.table\").withColumn(\"m\", map(lit(\"k\"), lit(1)))","handlingStrategy":"try-catch","validationCode":"// Ensure projected constants are scalar-only; move map-typed constants outside the scan","typeGuard":null,"tryCatchPattern":"try {\n  df.collect();\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().endsWith(\"does not implement getMap\")) {\n    // recompute the map column post-scan or disable vectorization\n  } else throw e;\n}","preventionTips":["Add map literals with withColumn after reading, not inside the same projection as the Iceberg scan","Enable vectorization in CI to catch unsupported constant column types early","Upgrade Iceberg when adding map-typed metadata projections"],"tags":["spark","vectorized-read","columnar","map"],"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-14T16:17:12.679Z"}