apache/iceberg · error · UnsupportedOperationException

readByte is not supported

Error message

readByte is not supported

What it means

VectorizedValuesReader.readByte is a default interface method that throws UnsupportedOperationException. Byte (single-byte) reads are only supported by implementations that override it; the default exists so unrelated reader implementations compile without a no-op stub.

Solutions

  1. Use a reader implementation that overrides readByte (the standard stream-backed implementations do).
  2. Read the value as readInteger() and narrow to byte in the caller.
  3. Override readByte in your custom VectorizedValuesReader implementation.

Example fix

// before
byte b = valuesReader.readByte(); // throws on non-overriding reader
// after
byte b = (byte) valuesReader.readInteger(); // width-safe on all implementations
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeWidth == 1 && !supportsByte(valuesReader)) { useNonVectorizedPath = true; }

Type guard

if (typeWidth == 1 && !overrides(valuesReader, "readByte")) {
  valuesReader = new StreamBackedValuesReader(...); // swap to full implementation
}

Prevention

When it happens

Trigger: Calling readByte() on a VectorizedValuesReader implementation that does not override it — typically while decoding a narrow-width column where the concrete reader lacks the byte-reading method.

Common situations: Reading Parquet INT32 data annotated as 1-byte ints through a reader implementation that only supports the full-width readInteger path; custom reader subclasses.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/9fbda91583ef5035. Report an issue: GitHub.

Appendix: source

Thrown at arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedValuesReader.java:46

 * Interface for value decoding that supports vectorized (aka batched) decoding. Implementations are
 * expected to be {@link ValuesReader} instances, and this interface "extends" that abstract class
 * by overriding the salient methods.
 */
interface VectorizedValuesReader {

  int INT_SIZE = 4;
  int LONG_SIZE = 8;
  int FLOAT_SIZE = 4;
  int DOUBLE_SIZE = 8;

  /** Read a single boolean */
  default boolean readBoolean() {
    throw new UnsupportedOperationException("readBoolean is not supported");
  }

  /** Read a single byte */
  default byte readByte() {
    throw new UnsupportedOperationException("readByte is not supported");
  }

  /** Read a single short */
  default short readShort() {
    throw new UnsupportedOperationException("readShort is not supported");
  }

  /** Read a single integer */
  default int readInteger() {
    throw new UnsupportedOperationException("readInteger is not supported");
  }

  /** Read a single long */
  default long readLong() {
    throw new UnsupportedOperationException("readLong is not supported");
  }

  /** Read a single float */

View on GitHub (pinned to 86d9c8fc54)