-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-16773: [Docs][Format] Document Run-Length encoding in Arrow columnar format #13333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8186f56
current state of RLE doc
zagto 70ea2fa
formatting
zagto 2ef0a24
minor fixes
zagto 3486009
replace copy-paste mistake with actual rle description
zagto 7c348ad
small fixes from PR comments
zagto cba824e
hold -> held
zagto f1e1a16
Apply suggestions from code review
zagto e3d3e9b
make rle parent length the logical length
zagto 77bb500
update columnar format doc
zagto b501674
Update docs/source/format/Columnar.rst
zagto 7211923
Update docs/source/format/Columnar.rst
zagto 86e12d1
Columnar doc: mention different bit-widths
zagto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -765,6 +765,65 @@ application. | |
| We discuss dictionary encoding as it relates to serialization further | ||
| below. | ||
|
|
||
| .. _run-length-encoded-layout: | ||
|
|
||
| Run-Length-encoded Layout | ||
| ------------------------- | ||
|
|
||
| Run-Length is a data representation that represents data as sequences of the | ||
| same value, called runs. Each run is represented as a value, and an integer | ||
| describing how often this value is repeated. | ||
|
|
||
| Any array can be run-length-encoded. A run-length encoded array has a single | ||
zagto marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| buffer holding as many signed 32-bit integers, as there are runs. The actual | ||
|
||
| values are held in a child array, which is just a regular array. | ||
|
|
||
| The values in the parent array buffer represent the length of each run. They do | ||
| not hold the length of the respective run directly, but the accumulated length | ||
| of all runs from the first to the current one. This allows relatively efficient | ||
| random access from a logical index using binary search. The length of an | ||
| individual run can be determined by subtracting two adjacent values. | ||
|
|
||
| A run has to have a length of at least 1. This means the values in the | ||
zagto marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| accumulated run lengths buffer are all positive and in strictly ascending | ||
| order. | ||
|
|
||
| An accumulated run length cannot be null, therefore the parent array has no | ||
| validity buffer. | ||
|
|
||
| As an example, you could have the following data: :: | ||
|
|
||
| type: Float32 | ||
| [1.0, 1.0, 1.0, 1.0, null, null, 2.0] | ||
|
|
||
| In Run-length-encoded form, this could appear as: | ||
|
|
||
| :: | ||
|
|
||
| * Length: 3, Null count: 2 | ||
zagto marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * Accumulated run lengths buffer: | ||
|
|
||
| | Bytes 0-3 | Bytes 4-7 | Bytes 8-11 | Bytes 6-63 | | ||
| |-------------|-------------|-------------|-----------------------| | ||
| | 4 | 6 | 7 | unspecified (padding) | | ||
zagto marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| * Children arrays: | ||
|
|
||
| * values (Float32): | ||
| * Length: 3, Null count: 1 | ||
| * Validity bitmap buffer: | ||
|
|
||
| | Byte 0 (validity bitmap) | Bytes 1-63 | | ||
| |--------------------------|-----------------------| | ||
| | 00000101 | 0 (padding) | | ||
|
|
||
| * Values buffer | ||
|
|
||
| | Bytes 0-3 | Bytes 4-7 | Bytes 8-11 | Bytes 6-63 | | ||
| |-------------|-------------|-------------|-----------------------| | ||
| | 1.0 | unspecified | 2.0 | unspecified (padding) | | ||
|
|
||
|
|
||
| Buffer Listing for Each Layout | ||
| ------------------------------ | ||
|
|
||
|
|
@@ -957,7 +1016,7 @@ The ``Buffer`` Flatbuffers value describes the location and size of a | |
| piece of memory. Generally these are interpreted relative to the | ||
| **encapsulated message format** defined below. | ||
|
|
||
| The ``size`` field of ``Buffer`` is not required to account for padding | ||
| The ``size`` field of ``Buffer`` is not required to account for paddingeng-career-mgmt | ||
zagto marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| bytes. Since this metadata can be used to communicate in-memory pointer | ||
| addresses between libraries, it is recommended to set ``size`` to the actual | ||
| memory size rather than the padded size. | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.