Skip to content

fix(arrow-select): handle all-empty run arrays in concat_run_arrays - #10782

Merged
alamb merged 3 commits into
apache:mainfrom
thorfour:fix/concat-run-arrays-empty-after-filter
Aug 24, 2026
Merged

alamb merged 3 commits into
apache:mainfrom
thorfour:fix/concat-run-arrays-empty-after-filter

Conversation

@thorfour

Copy link
Copy Markdown
Contributor

concat_run_arrays filters out any input RunArray whose run_ends() is empty before concatenating their values. When every input is filtered out this way (e.g. concatenating two zero-length slices of a nested RunEndEncoded struct field), the resulting values_slices is empty and falls through to concat(&[]), which errors because a type-erased &[&dyn Array] with no elements carries no DataType to build a result from.

Add an early return for the empty-after-filter case, building a valid zero-length array from the original (non-empty) input's DataType instead.

Which issue does this PR close?

Rationale for this change

concat_run_arrays should return a valid array instead of an error when empty run_ends are passed into it.

What changes are included in this PR?

A small empty run arrays check that returns an empty array of the data type instead.

Are these changes tested?

Yes a unit test was added

Are there any user-facing changes?

No

concat_run_arrays filters out any input RunArray whose run_ends() is
empty before concatenating their values. When every input is filtered
out this way (e.g. concatenating two zero-length slices of a nested
RunEndEncoded struct field), the resulting values_slices is empty and
falls through to concat(&[]), which errors because a type-erased
&[&dyn Array] with no elements carries no DataType to build a result
from.

Add an early return for the empty-after-filter case, building a valid
zero-length array from the original (non-empty) input's DataType
instead.
@github-actions github-actions Bot added arrow Changes to the arrow crate arrow-select labels Aug 21, 2026

@brancz brancz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@brancz

brancz commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

cc @alamb

@Rich-T-kid Rich-T-kid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice catch!

Comment thread arrow-select/src/concat.rs Resolved
Comment thread arrow-select/src/concat.rs Resolved
@Jefffrey Jefffrey added the bug Squash those bugs label Aug 22, 2026

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Makes sense to me -- thank you @thorfour

@alamb

alamb commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

I also think all @Jefffrey 's comments have been addressed so am merging this one in

@alamb
alamb merged commit 3577093 into apache:main Aug 24, 2026
34 checks passed
@alamb

alamb commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

alamb added a commit that referenced this pull request Aug 25, 2026
…n arrays (#10828)

# Which issue does this PR close?

- part of #10738

# Rationale for this change

Backport the fix for `concat_run_arrays` erroring when every input
RunArray has empty run_ends
(#10781) to the
`59_maintenance` branch so it is included in the 59.3.0 release.

# What changes are included in this PR?

Backport / Cherry-pick:
- #10782

# Are these changes tested?

By CI

# Are there any user-facing changes?

No

Co-authored-by: Thor <[email protected]>
Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Aug 28, 2026
…pache#10782)

concat_run_arrays filters out any input RunArray whose run_ends() is
empty before concatenating their values. When every input is filtered
out this way (e.g. concatenating two zero-length slices of a nested
RunEndEncoded struct field), the resulting values_slices is empty and
falls through to concat(&[]), which errors because a type-erased &[&dyn
Array] with no elements carries no DataType to build a result from.

Add an early return for the empty-after-filter case, building a valid
zero-length array from the original (non-empty) input's DataType
instead.

# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes apache#10781.

# Rationale for this change

`concat_run_arrays` should return a valid array instead of an error when
empty run_ends are passed into it.

# What changes are included in this PR?

A small empty run arrays check that returns an empty array of the data
type instead.

# Are these changes tested?

Yes a unit test was added

# Are there any user-facing changes?

No

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 2, 2026
…pache#10782)

concat_run_arrays filters out any input RunArray whose run_ends() is
empty before concatenating their values. When every input is filtered
out this way (e.g. concatenating two zero-length slices of a nested
RunEndEncoded struct field), the resulting values_slices is empty and
falls through to concat(&[]), which errors because a type-erased &[&dyn
Array] with no elements carries no DataType to build a result from.

Add an early return for the empty-after-filter case, building a valid
zero-length array from the original (non-empty) input's DataType
instead.

# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes apache#10781.

# Rationale for this change

`concat_run_arrays` should return a valid array instead of an error when
empty run_ends are passed into it.

# What changes are included in this PR?

A small empty run arrays check that returns an empty array of the data
type instead.

# Are these changes tested?

Yes a unit test was added

# Are there any user-facing changes?

No

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 18, 2026
…pache#10782)

concat_run_arrays filters out any input RunArray whose run_ends() is
empty before concatenating their values. When every input is filtered
out this way (e.g. concatenating two zero-length slices of a nested
RunEndEncoded struct field), the resulting values_slices is empty and
falls through to concat(&[]), which errors because a type-erased &[&dyn
Array] with no elements carries no DataType to build a result from.

Add an early return for the empty-after-filter case, building a valid
zero-length array from the original (non-empty) input's DataType
instead.

# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes apache#10781.

# Rationale for this change

`concat_run_arrays` should return a valid array instead of an error when
empty run_ends are passed into it.

# What changes are included in this PR?

A small empty run arrays check that returns an empty array of the data
type instead.

# Are these changes tested?

Yes a unit test was added

# Are there any user-facing changes?

No

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 21, 2026
…pache#10782)

concat_run_arrays filters out any input RunArray whose run_ends() is
empty before concatenating their values. When every input is filtered
out this way (e.g. concatenating two zero-length slices of a nested
RunEndEncoded struct field), the resulting values_slices is empty and
falls through to concat(&[]), which errors because a type-erased &[&dyn
Array] with no elements carries no DataType to build a result from.

Add an early return for the empty-after-filter case, building a valid
zero-length array from the original (non-empty) input's DataType
instead.

# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes apache#10781.

# Rationale for this change

`concat_run_arrays` should return a valid array instead of an error when
empty run_ends are passed into it.

# What changes are included in this PR?

A small empty run arrays check that returns an empty array of the data
type instead.

# Are these changes tested?

Yes a unit test was added

# Are there any user-facing changes?

No

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Sep 25, 2026
…pache#10782)

concat_run_arrays filters out any input RunArray whose run_ends() is
empty before concatenating their values. When every input is filtered
out this way (e.g. concatenating two zero-length slices of a nested
RunEndEncoded struct field), the resulting values_slices is empty and
falls through to concat(&[]), which errors because a type-erased &[&dyn
Array] with no elements carries no DataType to build a result from.

Add an early return for the empty-after-filter case, building a valid
zero-length array from the original (non-empty) input's DataType
instead.

# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes apache#10781.

# Rationale for this change

`concat_run_arrays` should return a valid array instead of an error when
empty run_ends are passed into it.

# What changes are included in this PR?

A small empty run arrays check that returns an empty array of the data
type instead.

# Are these changes tested?

Yes a unit test was added

# Are there any user-facing changes?

No

---------

Co-authored-by: Jeffrey Vo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate arrow-select bug Squash those bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

concat_run_arrays errors with empty run ends

5 participants