{"record":{"id":"a7266581d749344c","repo":"apache/iceberg","slug":"can-not-read-min-delta-in-current-block","errorCode":null,"errorMessage":"Can not read min delta in current block","messagePattern":"Can not read min delta in current block","errorType":"exception","errorClass":"ParquetDecodingException","httpStatus":null,"severity":"error","filePath":"arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedDeltaEncodedValuesReader.java","lineNumber":212,"sourceCode":"        i < miniBlockSizeInValues && valuesReadInMiniBlock < remaining;\n        i++) {\n      // calculate values from deltas unpacked for current block\n      long outValue = lastValueRead + minDeltaInCurrentBlock + unpackedValuesBuffer[i];\n      lastValueRead = outValue;\n      outputWriter.write(vec, ((long) (rowId + valuesReadInMiniBlock) * typeWidth), outValue);\n      remainingInBlock--;\n      remainingInMiniBlock--;\n      valuesReadInMiniBlock++;\n    }\n\n    return valuesReadInMiniBlock;\n  }\n\n  private void readBlockHeader() {\n    try {\n      minDeltaInCurrentBlock = BytesUtils.readZigZagVarLong(inputStream);\n    } catch (IOException e) {\n      throw new ParquetDecodingException(\"Can not read min delta in current block\", e);\n    }\n    readBitWidthsForMiniBlocks();\n    remainingInBlock = blockSizeInValues;\n    currentMiniBlock = 0;\n    remainingInMiniBlock = 0;\n  }\n\n  /**\n   * mini block has a size of 8*n, unpack 32 value each time\n   *\n   * <p>see org.apache.parquet.column.values.delta.DeltaBinaryPackingValuesReader#unpackMiniBlock\n   */\n  private void unpackMiniBlock() throws IOException {\n    Arrays.fill(this.unpackedValuesBuffer, 0);\n    BytePackerForLong packer =\n        Packer.LITTLE_ENDIAN.newBytePackerForLong(bitWidths[currentMiniBlock]);\n    for (int j = 0; j < miniBlockSizeInValues; j += 8) {\n      ByteBuffer buffer = inputStream.slice(packer.getBitWidth());","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedDeltaEncodedValuesReader.java#L194-L230","documentation":"readBlockHeader reads the block's minimum delta via a zig-zag variable-length long from the encoded stream. If BytesUtils.readZigZagVarLong throws IOException (stream exhausted or malformed varint), the reader throws ParquetDecodingException. This means the DELTA_BINARY_PACKED block header is unreadable — the data is corrupt, truncated, or not actually delta encoded.","triggerScenarios":"readBlockHeader (invoked from loadMiniBlockToOutput) hits an IOException while parsing the min-delta varint at a block boundary.","commonSituations":"Truncated Parquet files from failed writes or partial uploads, corrupt data pages, or byte-stream misalignment from a buggy encoder.","solutions":["Re-read/retry to rule out transient storage errors, then validate the file's integrity.","Rewrite the affected data files from the source (e.g. Iceberg rewrite_data_files) if they are truncated or corrupt.","Fix or upgrade the writer that produced the delta-encoded files.","Disable vectorized reads as a fallback reader."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  // vectorized read\n} catch (ParquetDecodingException e) {\n  if (e.getMessage().contains(\"Can not read min delta in current block\")) {\n    // mark file corrupt, rewrite from source, or fall back to non-vectorized reader\n  } else throw e;\n}","preventionTips":["Ensure writers fully flush/close files before publishing","Validate Parquet footer/metadata before commit (e.g. Iceberg concurrent file checks)","Upgrade buggy encoders that misalign delta-packed streams"],"tags":["parquet","decoding","corrupt-data"],"backgroundTag":"file-read-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}