{"record":{"id":"5e1715043c69f009","repo":"prestodb/presto","slug":"not-a-valid-mode-5e1715","errorCode":null,"errorMessage":"not a valid mode ","messagePattern":"not a valid mode ","errorType":"exception","errorClass":"ParquetDecodingException","httpStatus":null,"severity":"error","filePath":"presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/decoders/rle/Int32RLEDictionaryValuesDecoder.java","lineNumber":76,"sourceCode":"                case RLE: {\n                    final int rleValue = currentValue;\n                    final int rleDictionaryValue = dictionary.decodeToInt(rleValue);\n                    while (destinationIndex < endIndex) {\n                        values[destinationIndex++] = rleDictionaryValue;\n                    }\n                    break;\n                }\n                case PACKED: {\n                    final int[] localCurrentBuffer = currentBuffer;\n                    final IntegerDictionary localDictionary = dictionary;\n                    for (int sourceIndex = currentBuffer.length - currentCount; destinationIndex < endIndex; sourceIndex++) {\n                        int dictionaryValue = localDictionary.decodeToInt(localCurrentBuffer[sourceIndex]);\n                        values[destinationIndex++] = dictionaryValue;\n                    }\n                    break;\n                }\n                default:\n                    throw new ParquetDecodingException(\"not a valid mode \" + mode);\n            }\n\n            currentCount -= numEntriesToFill;\n            remainingToCopy -= numEntriesToFill;\n        }\n    }\n\n    @Override\n    public void skip(int length)\n            throws IOException\n    {\n        checkArgument(length >= 0, \"invalid length %s\", length);\n        int remaining = length;\n        while (remaining > 0) {\n            if (currentCount == 0) {\n                if (!decode()) {\n                    break;\n                }","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/decoders/rle/Int32RLEDictionaryValuesDecoder.java#L58-L94","documentation":"Int32RLEDictionaryValuesDecoder.readNext() fills value batches by switching on the decoder's MODE (RLE_RUN, PACKED, or dictionary-index run). The default branch throws ParquetDecodingException(\"not a valid mode \" + mode) when the current mode enum is unrecognized. Because the mode is set internally from the RLE header's low bit, this fires when the header stream yields an unexpected mode or decoder state was never initialized to a supported mode, indicating malformed or unsupported page data for an INT32 dictionary-encoded column.","triggerScenarios":"Public readNext() (batch read path) processes a run whose mode field holds a value not covered by the switch — i.e., the RLE/bit-packed hybrid header decoded from the page buffer produced an out-of-enum mode, typically from a malformed or truncated data page for an INT32 dictionary-encoded column.","commonSituations":"Corrupt or truncated Parquet INT32 column chunks; files written by writers emitting non-standard RLE headers; page-byte-offset miscomputation after dictionary-page decoding; Presto batch-reader bugs with certain hybrid RLE runs in older releases.","solutions":["Validate the file with parquet-tools and re-export it if the page data is corrupt or truncated.","Disable dictionary encoding for the column on the writer side (e.g., parquet.enable.dictionary=false) and rewrite the file as plain/RLE.","Confirm the reader and writer versions agree on the Parquet format; upgrade Presto to pick up batch-reader fixes.","Fall back to the non-batch Parquet reader path for this column, which handles more edge cases."],"exampleFix":"// before\nInt32RLEDictionaryValuesDecoder d = new Int32RLEDictionaryValuesDecoder(...);\nd.readNext(buffer, 100); // ParquetDecodingException: not a valid mode ...\n\n// after: guard the read and fall back\ntry {\n    d.readNext(buffer, 100);\n} catch (ParquetDecodingException e) {\n    values = readWithStreamingReader(columnChunk, 100); // non-batch fallback\n}","handlingStrategy":"fallback","validationCode":"// Check the column chunk encoding before using the dictionary batch decoder\nEncoding enc = chunk.getEncoding();\nif (enc != Encoding.RLE_DICTIONARY && enc != Encoding.PLAIN_DICTIONARY) {\n    throw new IllegalStateException(\"Unexpected encoding \" + enc + \" for \" + column);\n}","typeGuard":null,"tryCatchPattern":"try {\n    decoder.readNext(buffer, length);\n} catch (ParquetDecodingException e) {\n    values = streamingReader.readInts(columnChunk, length); // non-batch fallback\n}","preventionTips":["Disable dictionary encoding on the writer for columns with malformed-page history.","Validate files post-write with parquet-tools dump.","Upgrade Presto to a release with batch-reader RLE fixes.","Alert on job failures that may leave truncated files in table locations."],"tags":["parquet","decoding","dictionary-encoding","rle-encoding"],"backgroundTag":"parquet-decoding-failed","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}