Skip to content

Refactor RleEncoder::flush_bit_packed_run #9734

@etseidl

Description

@etseidl

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
While reviewing #9653 I had a hard time understanding the transition from bit-packed runs to RLE runs, largely due to a confusing use of flush_bit_packed_run and some misleading comments.

The current flush_bit_packed_run actually serves two purpose. The first is to flush a batch of buffered values as a bit-packed run, the second is to end a bit-packed run by writing the number of 8-element groups that have been written to the beginning of the run. When transitioning from bit-packed to RLE mode, flush_buffered_values first sets the number of buffered values to 0, and then conditionally calls flush_bit_packed_run(true). By setting the number of buffered values to 0, flush_bit_packed_run writes no actual data, so the entire purpose of the call is to write the number of groups.

Describe the solution you'd like
I'd like to split flush_bit_packed_run into two functions: flush_bit_packed_run to actually write data, and finish_bit_packed_run to write the number of groups. This allows calling finish_bit_packed_run directly from flush_buffered_values making the intent clearer.

Describe alternatives you've considered

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAny new improvement worthy of a entry in the changelog

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions