{"record":{"id":"05dc7bec9ac5d13b","repo":"apache/iceberg","slug":"class-does-not-implement-getarray","errorCode":null,"errorMessage":"${class} does not implement getArray","messagePattern":"(.+?) does not implement getArray","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":102,"sourceCode":"\n  @Override\n  public long getLong(int rowId) {\n    return (long) constant;\n  }\n\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","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ConstantColumnVector.java#L84-L120","documentation":"ConstantColumnVector represents a column whose every row has the same constant value (e.g. from a constant partition column or fill with defaults). It only supports scalar accessors; getArray (and getMap) are intentionally unimplemented and throw UnsupportedOperationException because a constant nested value is not representable this way.","triggerScenarios":"A vectorized read produces a constant vector holder for a column whose Spark type is ArrayType (or MapType), and Spark calls getArray on it — i.e. a constant of a nested type flowing through the vectorized read path.","commonSituations":"Schema evolution adding a nested column with a constant default via add_column with a default value; reading partition columns typed as arrays/maps; Iceberg versions lacking constant nested support.","solutions":["Upgrade iceberg-spark to a version that supports constant nested column vectors.","Avoid setting constant defaults (or constant partition values) for array/map typed columns.","Disable vectorized reads for the scan (read.spark.vectorization.enabled=false) to use the row-based path."],"exampleFix":"// before\n// ALTER TABLE ... ADD COLUMN tags array<string> DEFAULT array('a')\n// after — avoid nested constant defaults, or:\nspark.conf.set(\"read.spark.vectorization.enabled\", \"false\")","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  df = spark.read().format(\"iceberg\").load(table);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().endsWith(\"does not implement getArray\")) {\n    spark.conf().set(\"read.spark.vectorization.enabled\", \"false\");\n    df = spark.read().format(\"iceberg\").load(table);\n  }\n}","preventionTips":["Do not add constant defaults or constant partition values for array/map columns on older Iceberg","Upgrade iceberg-spark for constant nested-vector support","Use vectorization-off sessions when querying such columns"],"tags":["spark","vectorized-read","columnar","nested-types"],"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"}