{"record":{"id":"c40ca5b14364ba0e","repo":"prestodb/presto","slug":"not-a-valid-mode-c40ca5","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/Int64TimeAndTimestampMicrosRLEDictionaryValuesDecoder.java","lineNumber":88,"sourceCode":"                    final int rleValue = currentValue;\n                    final long rleDictionaryValue = MICROSECONDS.toMillis(dictionary.decodeToLong(rleValue));\n                    while (destinationIndex < endIndex) {\n                        values[destinationIndex++] = packFunction.pack(rleDictionaryValue);\n                    }\n                    break;\n                }\n                case PACKED: {\n                    final int[] localBuffer = currentBuffer;\n                    final LongDictionary localDictionary = dictionary;\n                    for (int srcIndex = currentBuffer.length - currentCount; destinationIndex < endIndex; srcIndex++) {\n                        long dictionaryValue = localDictionary.decodeToLong(localBuffer[srcIndex]);\n                        long millisValue = MICROSECONDS.toMillis(dictionaryValue);\n                        values[destinationIndex++] = packFunction.pack(millisValue);\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        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()) {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/decoders/rle/Int64TimeAndTimestampMicrosRLEDictionaryValuesDecoder.java#L70-L106","documentation":"Int64TimeAndTimestampMicrosRLEDictionaryValuesDecoder.readNext() decodes INT64 timestamp-micros dictionary indices, converting each dictionary value from microseconds to millis and packing it via packFunction before storing into the output array. The switch over the run's MODE throws ParquetDecodingException(\"not a valid mode \" + mode) in the default branch when the run mode is unrecognized. This means the RLE hybrid header in the timestamp column's data page was invalid or the decoder state was corrupted, so the micros timestamp values cannot be decoded.","triggerScenarios":"readNext() — reached via int64BatchReadWithSkipHelper — processes a run whose mode is not RLE/PACKED/dictionary-supported: malformed or truncated timestamp (MICROS unified) data page header, or misaligned page buffer.","commonSituations":"Corrupt timestamp column chunks in Parquet files; writers emitting non-standard isAdjustedToUTC/timestamp-micros pages; Presto version mismatch between batch reader expectations and file format; failed compaction jobs leaving partial files.","solutions":["Verify the file with parquet-tools and re-export it if the timestamp column chunk is corrupt.","Rewrite the data with standard Parquet writer settings (INT64 timestamp micros, standard RLE dictionary).","Upgrade Presto — timestamp batch decoders have received correctness fixes across releases.","Use the non-batch (streaming) timestamp reader path as a fallback for this file."],"exampleFix":"// before\ndecoder.readNext(values, offset, length); // ParquetDecodingException: not a valid mode ...\n\n// after\ntry {\n    decoder.readNext(values, offset, length);\n} catch (ParquetDecodingException e) {\n    logger.warn(e, \"Falling back to streaming reader for %s\", path);\n    values = streamingReader.readTimestamps(offset, length);\n}","handlingStrategy":"fallback","validationCode":"// Ensure the file passes footer validation before decoding timestamp pages\nbyte[] tail = readTail(dataSource, 8);\nif (!endsWith(tail, \"PAR1\") && !endsWith(tail, \"PARE\")) {\n    throw new IOException(\"Invalid Parquet magic: \" + dataSource.getId());\n}","typeGuard":null,"tryCatchPattern":"try {\n    decoder.readNext(values, offset, length);\n} catch (ParquetDecodingException e) {\n    logger.warn(e, \"Timestamp batch decode failed for %s; using streaming reader\", path);\n    values = streamingReader.readTimestamps(columnChunk, offset, length);\n}","preventionTips":["Write timestamps with a standard logical type (TIMESTAMP_MICROS) instead of legacy INT96 where possible.","Validate written files with parquet-tools before publishing.","Upgrade Presto — timestamp batch decoders had parsing fixes.","Keep a plain-encoding fallback path for known-problem files."],"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"}