apache/iceberg · error · UnsupportedOperationException

UnsupportedOperationException with no message…

Error message

UnsupportedOperationException with no message (DictionaryIdReader)

What it means

DictionaryIdReader.nextVal is a hook that always throws UnsupportedOperationException with no message. DictionaryIdReader only implements dictionary-encoded value reads, so a caller invoking the plain (non-dictionary) per-value read path is a programming error — the wrong reader was selected for the page's encoding.

Solutions

  1. Ensure the reader constructed in the definition-level reader matches the page encoding (use the plain reader for non-dictionary pages).
  2. Verify the file's encoding vs. expectation; re-write the file with standard encodings.
  3. If hitting this in your own subclass, implement nextVal instead of inheriting the throwing default.

Example fix

// before
reader = new DictionaryIdReader(...); // chosen unconditionally
// after
reader = page.isDictionaryEncoded() ? new DictionaryIdReader(...) : new PlainReader(...);
Defensive patterns

Strategy: type-guard

Validate before calling

// choose reader based on page encoding before dispatch
boolean useDictReader = page.isDictionaryEncoded();
if (!useDictReader && reader instanceof DictionaryIdReader) {
  throw new IllegalStateException("DictionaryIdReader selected for non-dictionary page");
}

Type guard

if (reader instanceof DictionaryIdReader && !page.isDictionaryEncoded()) {
  throw new IllegalStateException("DictionaryIdReader cannot service plain pages");
}

Prevention

When it happens

Trigger: Calling nextVal (the plain values path) on a DictionaryIdReader — i.e. reading a column whose reader was built for dictionary ids when the page is not dictionary encoded, or an internal dispatch bug selecting DictionaryIdReader for a plain-encoded page.

Common situations: Internal dispatch mistakes in the vectorized definition-level reader when a page's encoding differs from what was detected at page init (e.g. a page that turned out not to be dictionary encoded but the dictionary reader was retained).

Related errors


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

Appendix: source

Thrown at arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedParquetDefinitionLevelReader.java:665

        Dictionary dict,
        Mode mode,
        int numValues,
        NullabilityHolder holder,
        int typeWidth) {
      throw new UnsupportedOperationException();
    }
  }

  class DictionaryIdReader extends BaseReader {

    @Override
    protected void nextVal(
        FieldVector vector,
        int idx,
        VectorizedValuesReader valuesReader,
        int typeWidth,
        byte[] byteArray) {
      throw new UnsupportedOperationException();
    }

    @Override
    protected void nextDictEncodedVal(
        FieldVector vector,
        int idx,
        VectorizedDictionaryEncodedParquetValuesReader reader,
        Dictionary dict,
        Mode mode,
        int numValues,
        NullabilityHolder holder,
        int typeWidth) {
      if (Mode.RLE.equals(mode)) {
        reader.dictionaryIdReader().nextBatch(vector, idx, numValues, dict, holder, typeWidth);
      } else if (Mode.PACKED.equals(mode)) {
        vector.getDataBuffer().setInt((long) idx * IntVector.TYPE_WIDTH, reader.readInteger());
      }
    }

View on GitHub (pinned to 86d9c8fc54)