Skip to content

GH-44183: [C++] Support run-end encoded struct, list (view), large list (view) and map values - #50534

Merged
pitrou merged 4 commits into
apache:mainfrom
BenMagyar:bmagyar/ree-lists
Jul 30, 2026
Merged

GH-44183: [C++] Support run-end encoded struct, list (view), large list (view) and map values#50534
pitrou merged 4 commits into
apache:mainfrom
BenMagyar:bmagyar/ree-lists

Conversation

@BenMagyar

@BenMagyar BenMagyar commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

From #44183 - creating run-end encoded cols that contain list or struct values is unsupported. Adding support for both the encode and decode paths.

What changes are included in this PR?

  • Adding support for List, ListView, LargeList, LargeListView, Map, FixedSizeList and Struct values in the run_end_encode and the run_end_decode paths.
  • Support list of lists as part of that as well.

Are these changes tested?

  • Yes added covering tests

Are there any user-facing changes?

There are but they are not breaking. Currently the encode path throws that it is unsupported on one of these types. We are adding support.

Adding the encode path for nested-value encoding for List, FixedSizeList and Struct arrays
Adding the decode path for nested-value encoding for List, FixedSizeList and Struct arrays
@github-actions github-actions Bot added the awaiting review Awaiting review label Jul 17, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #44183 has been automatically assigned in GitHub to PR creator.

@BenMagyar BenMagyar changed the title GH-44183: Support run-end encoded GH-44183: Support run-end encoded nested structs and lists Jul 17, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #44183 has been automatically assigned in GitHub to PR creator.

@BenMagyar BenMagyar changed the title GH-44183: Support run-end encoded nested structs and lists GH-44183: Support run-end encoded struct and list values Jul 17, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #44183 has been automatically assigned in GitHub to PR creator.

1 similar comment
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #44183 has been automatically assigned in GitHub to PR creator.

@BenMagyar BenMagyar changed the title GH-44183: Support run-end encoded struct and list values GH-44183: [C++][Python] Support run-end encoded struct and list values Jul 17, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #44183 has been automatically assigned in GitHub to PR creator.

Comment thread cpp/src/arrow/compute/kernels/vector_run_end_encode.cc
@BenMagyar BenMagyar changed the title GH-44183: [C++][Python] Support run-end encoded struct and list values GH-44183: [C++][Python] Support run-end encoded struct, list (view), large list (view) and map values Jul 28, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #44183 has been automatically assigned in GitHub to PR creator.

1 similar comment
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #44183 has been automatically assigned in GitHub to PR creator.

@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Jul 29, 2026
Comment on lines +560 to +563
for (int64_t i = 0; i < run_length; ++i) {
RETURN_NOT_OK(
output_builder->AppendArraySlice(input_values, physical_index, 1));
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be more performant to implement this as:

Suggested change
for (int64_t i = 0; i < run_length; ++i) {
RETURN_NOT_OK(
output_builder->AppendArraySlice(input_values, physical_index, 1));
}
ARROW_ASSIGN_OR_RAISE(
auto scalar, input_values.GetScalar(physical_index));
RETURN_NOT_OK(output_builder->AppendScalar(scalar, run_length));

GetScalar adds its own cost, but it's amortized over the entire run.

@felipecrv What do you think?

@BenMagyar BenMagyar Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran some some mini benchmarks to test this:

Value type Run length 1 Run length 64 Run length 4096 Run length 16384
List<Int32>[4] 32.5x slower 12.1x slower 11.5x slower 11.6x slower
List<Int32>[64] 126.3x slower 116.3x slower 115.9x slower 115.2x slower
LargeList<Int32>[8] 41.9x slower 22.3x slower 21.8x slower 22.1x slower
ListView<Int32>[8] 41.7x slower 22.1x slower 21.7x slower 21.7x slower
LargeListView<Int32>[8] 42.3x slower 22.2x slower 21.9x slower 21.6x slower
FixedSizeList<Int32>[8] 53.4x slower 26.2x slower 25.7x slower 25.6x slower
Map<Utf8, Int32>[4] 130.5x slower 107.9x slower 109.6x slower 107.0x slower
Struct mixed 58.9x slower 16.5x slower 15.6x slower 15.7x slower
Empty List 24.2x slower 0.75x 0.35x 0.35x
List<Int32>[1] 23.7x slower 3.5x slower 3.1x slower 3.1x slower
Empty Map 28.0x slower 1.0x 0.52x 0.51x
Struct<Int32> 34.9x slower 1.4x slower 0.84x 0.77x
Empty Struct 30.6x slower 1.1x slower 0.56x 0.56x

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, sorry for the bad idea then :)

Comment thread python/pyarrow/tests/test_table.py Outdated
@BenMagyar BenMagyar changed the title GH-44183: [C++][Python] Support run-end encoded struct, list (view), large list (view) and map values GH-44183: [C++] Support run-end encoded struct, list (view), large list (view) and map values Jul 29, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #44183 has been automatically assigned in GitHub to PR creator.

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @BenMagyar ! This looks good to me now.

@pitrou

pitrou commented Jul 30, 2026

Copy link
Copy Markdown
Member

CI failures are unrelated, I'll merge.

@pitrou
pitrou merged commit acbbe11 into apache:main Jul 30, 2026
58 of 63 checks passed
@pitrou pitrou removed the awaiting committer review Awaiting committer review label Jul 30, 2026
@github-actions github-actions Bot added the awaiting committer review Awaiting committer review label Jul 30, 2026
@BenMagyar
BenMagyar deleted the bmagyar/ree-lists branch July 31, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants