{"record":{"id":"51da6f400e60dcab","repo":"apache/iceberg","slug":"unsupportedoperationexception-with-no-message-dic","errorCode":null,"errorMessage":"UnsupportedOperationException with no message (DictionaryIdReader)","messagePattern":"UnsupportedOperationException with no message \\(DictionaryIdReader\\)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedParquetDefinitionLevelReader.java","lineNumber":665,"sourceCode":"        Dictionary dict,\n        Mode mode,\n        int numValues,\n        NullabilityHolder holder,\n        int typeWidth) {\n      throw new UnsupportedOperationException();\n    }\n  }\n\n  class DictionaryIdReader extends BaseReader {\n\n    @Override\n    protected void nextVal(\n        FieldVector vector,\n        int idx,\n        VectorizedValuesReader valuesReader,\n        int typeWidth,\n        byte[] byteArray) {\n      throw new UnsupportedOperationException();\n    }\n\n    @Override\n    protected void nextDictEncodedVal(\n        FieldVector vector,\n        int idx,\n        VectorizedDictionaryEncodedParquetValuesReader reader,\n        Dictionary dict,\n        Mode mode,\n        int numValues,\n        NullabilityHolder holder,\n        int typeWidth) {\n      if (Mode.RLE.equals(mode)) {\n        reader.dictionaryIdReader().nextBatch(vector, idx, numValues, dict, holder, typeWidth);\n      } else if (Mode.PACKED.equals(mode)) {\n        vector.getDataBuffer().setInt((long) idx * IntVector.TYPE_WIDTH, reader.readInteger());\n      }\n    }","sourceCodeStart":647,"sourceCodeEnd":683,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedParquetDefinitionLevelReader.java#L647-L683","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Ensure the reader constructed in the definition-level reader matches the page encoding (use the plain reader for non-dictionary pages).","Verify the file's encoding vs. expectation; re-write the file with standard encodings.","If hitting this in your own subclass, implement nextVal instead of inheriting the throwing default."],"exampleFix":"// before\nreader = new DictionaryIdReader(...); // chosen unconditionally\n// after\nreader = page.isDictionaryEncoded() ? new DictionaryIdReader(...) : new PlainReader(...);","handlingStrategy":"type-guard","validationCode":"// choose reader based on page encoding before dispatch\nboolean useDictReader = page.isDictionaryEncoded();\nif (!useDictReader && reader instanceof DictionaryIdReader) {\n  throw new IllegalStateException(\"DictionaryIdReader selected for non-dictionary page\");\n}","typeGuard":"if (reader instanceof DictionaryIdReader && !page.isDictionaryEncoded()) {\n  throw new IllegalStateException(\"DictionaryIdReader cannot service plain pages\");\n}","tryCatchPattern":null,"preventionTips":["Match reader selection to page encoding at page init time.","Unit-test dispatch for files that switch encoding between pages.","Avoid subclassing DictionaryIdReader without implementing nextVal."],"tags":["parquet","dictionary-encoding","internal-dispatch"],"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-23T08:17:48.524Z"}