{
  "slug": "run-length-encoding",
  "term": "Run-length encoding",
  "aliases": [
    "RLE"
  ],
  "definition": "Run-length encoding represents a sequence of equal values by storing the value and the extent of its repetition.",
  "note": "Runs: Adjacent equal values can share one representation. Arrow's run-end encoding stores cumulative end positions rather than separate run lengths, so an RLE label does not identify one interchangeable byte format. [arrow-layout]\n\nBlocks: A Zstandard RLE_Block carries one content byte. Its Block_Size field gives the number of decoded repetitions, not the encoded content size. The three-byte block header and frame overhead are additional. [rfc8878]\n\nHybrid: Parquet combines repeated-value runs with bit-packed groups. At width 3, eight copies of 5 give the hexadecimal run fragment 10 05: a count header followed by the repeated value. This excludes external width information and page framing. [parquet-encoding]\n\nFraming: Parquet level streams prepend a four-byte encoded length in data page v1, but not v2. Dictionary indices omit that prefix in both versions; RLE Boolean streams retain it in both. The enclosing page and data kind select the rule. [parquet-encoding]",
  "status": "shipping",
  "advantages": [],
  "limitations": [
    {
      "text": "The decoder must enforce format-specific size limits before expanding a run into output.",
      "citationIds": [
        "rfc8878"
      ]
    }
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-17",
  "related": [
    "bit-packing",
    "lossless-compression",
    "parquet"
  ],
  "citations": [
    {
      "id": "parquet-encoding",
      "title": "Apache Parquet: RLE/bit-packing hybrid and deprecated BIT_PACKED encodings",
      "url": "https://parquet.apache.org/docs/file-format/data-pages/encodings/",
      "accessed": "2026-11-17"
    },
    {
      "id": "rfc8878",
      "title": "RFC 8878: Zstandard block header and RLE_Block, section 3.1.1.2",
      "url": "https://www.rfc-editor.org/rfc/rfc8878.html#section-3.1.1.2",
      "accessed": "2026-11-17"
    },
    {
      "id": "arrow-layout",
      "title": "Apache Arrow: Boolean, validity bitmap and run-end encoded layouts",
      "url": "https://arrow.apache.org/docs/format/Columnar.html",
      "accessed": "2026-11-17"
    }
  ],
  "provenance": [
    "Source synthesis and exact illustrative bytes, not a compression-ratio or performance measurement. Run-length-limited recording codes are a separate concept."
  ]
}
