{"record":{"id":"4746a7d274c37ae2","repo":"apache/iceberg","slug":"unsupported-type-byte-4746a7","errorCode":null,"errorMessage":"Unsupported type - byte","messagePattern":"Unsupported type - byte","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/IcebergArrowColumnVector.java","lineNumber":90,"sourceCode":"\n  @Override\n  public int numNulls() {\n    return nullabilityHolder.numNulls();\n  }\n\n  @Override\n  public boolean isNullAt(int rowId) {\n    return nullabilityHolder.isNullAt(rowId) == 1;\n  }\n\n  @Override\n  public boolean getBoolean(int rowId) {\n    return accessor.getBoolean(rowId);\n  }\n\n  @Override\n  public byte getByte(int rowId) {\n    throw new UnsupportedOperationException(\"Unsupported type - byte\");\n  }\n\n  @Override\n  public short getShort(int rowId) {\n    throw new UnsupportedOperationException(\"Unsupported type - short\");\n  }\n\n  @Override\n  public int getInt(int rowId) {\n    return accessor.getInt(rowId);\n  }\n\n  @Override\n  public long getLong(int rowId) {\n    return accessor.getLong(rowId);\n  }\n\n  @Override","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/IcebergArrowColumnVector.java#L72-L108","documentation":"IcebergArrowColumnVector exposes Arrow accessors to Spark's columnar API. The Arrow-backed vectors produced here never carry byte-typed data, so getByte() is intentionally unimplemented and always throws UnsupportedOperationException.","triggerScenarios":"Spark calls getByte(rowId) on an Arrow-backed vector, which happens when a batch column's Spark type is ByteType while the reader does not produce byte accessors.","commonSituations":"Reading a table with a Spark ByteType-mapped column (Iceberg Integer with byte upcast, or a Spark-side cast to byte) under vectorized read.","solutions":["Read the column as IntegerType and cast to byte in Spark after the scan","Disable vectorized reads (spark.read.option or read.split.vectorization.enabled=false)","Change the table schema to avoid byte-width columns if possible","Upgrade Iceberg in case byte accessor support was added"],"exampleFix":"// before\nval df = spark.read.format(\"iceberg\").load(\"t\") // tinyint column read vectorized\n// after\nspark.conf.set(\"read.split.vectorization.enabled\", \"false\")\nval df = spark.read.format(\"iceberg\").load(\"t\").col(\"c\").cast(\"byte\")","handlingStrategy":"type-guard","validationCode":"if (schema.fields().anyMatch(f -> f.dataType() == ByteType)) { spark.conf.set(\"read.split.vectorization.enabled\", \"false\"); }","typeGuard":"boolean byteSafe(ColumnVector v) { return !(v instanceof IcebergArrowColumnVector); }","tryCatchPattern":"try { b = vector.getByte(rowId); } catch (UnsupportedOperationException e) { int widened = vector.getInt(rowId); b = (byte) widened; }","preventionTips":["Read Iceberg integers as int and cast to byte in Spark","Scan the schema for byte-typed columns before enabling vectorization"],"tags":["spark","vectorized-read","arrow","unsupported-type"],"backgroundTag":"unsupported-dtype","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"}