{"record":{"id":"1d661a3ddd23835a","repo":"prestodb/presto","slug":"not-a-valid-mode-1d661a","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/TimestampRLEDictionaryValuesDecoder.java","lineNumber":77,"sourceCode":"            switch (mode) {\n                case RLE: {\n                    final int rleValue = currentValue;\n                    final long rleValueMillis = dictionary.decodeToLong(rleValue);\n                    while (destinationIndex < endIndex) {\n                        values[destinationIndex++] = rleValueMillis;\n                    }\n                    break;\n                }\n                case PACKED: {\n                    final int[] localBuffer = currentBuffer;\n                    final TimestampDictionary localDictionary = dictionary;\n                    for (int srcIndex = currentBuffer.length - currentCount; destinationIndex < endIndex; srcIndex++) {\n                        values[destinationIndex++] = localDictionary.decodeToLong(localBuffer[srcIndex]);\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        checkState(remainingToCopy == 0, \"End of stream: Invalid read size request\");\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;","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/decoders/rle/TimestampRLEDictionaryValuesDecoder.java#L59-L95","documentation":"TimestampRLEDictionaryValuesDecoder.readNext() decodes INT96 timestamp dictionary indices into packed long timestamp values, switching over the run's MODE. The default branch throws ParquetDecodingException(\"not a valid mode \" + mode) when the run mode decoded from the page header is not one of the supported modes. As with the other RLE dictionary decoders, the mode comes from the RLE hybrid header's low bit, so this signals a malformed, truncated, or misaligned data page in a timestamp column chunk.","triggerScenarios":"Public readNext() processes a run whose mode is unsupported — a bad or truncated RLE header in an INT96/timestamp dictionary-encoded data page, or a page buffer handed to the decoder at the wrong byte offset.","commonSituations":"Corrupt or partially written Parquet files; Hive writing INT96 timestamps read by a Presto version with batch-reader parsing bugs; wrong page-offset metadata after compaction; files produced by third-party writers deviating from the Parquet spec.","solutions":["Check file integrity with parquet-tools and regenerate the file if the timestamp column chunk is damaged.","Upgrade Presto; several timestamp batch-reader header parsing bugs were fixed in later releases.","Rewrite the table with a supported timestamp logical type (TIMESTAMP_MICROS/TIMESTAMP_MILLIS instead of INT96) if the writer supports it.","Fall back to the non-batch reader path for this file/column."],"exampleFix":"// before\ndecoder.readNext(values, offset, length); // throws 'not a valid mode ...'\n\n// after: fail with context instead of raw decoder error\ntry {\n    decoder.readNext(values, offset, length);\n} catch (ParquetDecodingException e) {\n    throw new PrestoException(PARQUET_CORRUPT_DATA,\n        \"Invalid RLE mode in timestamp column \" + column + \" of \" + path, e);\n}","handlingStrategy":"try-catch","validationCode":"// Validate footer and page-level metadata before decoding\nParquetMetadata meta = MetadataReader.readFooter(dataSource, fileSize);\ncheckArgument(!meta.getBlocks().isEmpty(), \"No row groups in \" + dataSource.getId());","typeGuard":null,"tryCatchPattern":"try {\n    decoder.readNext(values, offset, length);\n} catch (ParquetDecodingException e) {\n    throw new PrestoException(PARQUET_CORRUPT_DATA,\n        \"Invalid RLE mode in timestamp column \" + column, e);\n}","preventionTips":["Validate Parquet files after compaction/write jobs; truncate-and-publish failures are common root causes.","Upgrade Presto for INT96 timestamp batch-reader fixes.","Prefer TIMESTAMP_MICROS/MILLIS logical types over legacy INT96.","Fall back to the non-batch reader for files with a history of decode errors."],"tags":["parquet","decoding","timestamp","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"}