Skip to content

Parquet writer: encode definition and repetition levels a group at a time #12194

Open

Description

@JonSnow1807

The Parquet writer encodes definition and repetition levels one value at a time. RleEncoder already has a group-of-8 path (put_batch) that dictionary indices use. Routing levels through it keeps the encoded bytes identical (88/88 written files hash the same) and, on the arrow_writer benches (i7-14700, one pinned core, 5 interleaved rounds, about ±1% noise), takes less time for:

  • nested columns: list_struct_with_list -29.6%, list_nested -27.4%, list_primitive -23.7%, map -15.1%
  • flat nullable columns: primitive -25.6%, bool -38%
  • non-null and all-null columns: -2.6% to +1.1%

This is most of apache/datafusion-comet#6918. A few dictionary benches moved 3-11% in the default build, which looks like code placement: the same or fewer instructions, and within ±2% with one codegen unit.

I’d split it into a PR adding level-encoding and nested-writer benches, then the change. @HippoBaro does this fit with #11273?

Activity

  1. jhorstmann commented on Nov 12, 2026

    @jhorstmann
    Contributor

    Might also help in solving #7739, if the last rle run was short and the next run is bitpacked, the short rle run could be converted to bitpacked.

  2. JonSnow1807 commented on Nov 12, 2026

    @JonSnow1807
    ContributorAuthor

    Good point, thanks. With a whole group of 8 in hand, the encoder can see that a short repeated run is followed by literals and keep it as literals. I’ll measure decoding on the #7739 case too.

  3. added
    Prolific Author
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Prolific Author

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions