Skip to content

GH-55956: [C++][Compute] Avoid unnecessary work for empty chunked take indices - #55957

Open
Sumdiboii wants to merge 1 commit into
apache:mainfrom
Sumdiboii:perf-small-code-optimization
Open

Sumdiboii wants to merge 1 commit into
apache:mainfrom
Sumdiboii:perf-small-code-optimization

Conversation

@Sumdiboii

@Sumdiboii Sumdiboii commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Rationale for this change

Taking from a chunked array with an empty chunked indices array should produce an empty result without doing unnecessary work on the values so why not...

What changes are included in this PR?

Return a typed empty result when the indices have no chunks, without concatenating the values. Reuse the indices' chunk count for allocation and iteration in the non-empty case.

Are these changes tested?

  • ninja -C cpp -j1 arrow-compute-vector-selection-test — passed.
  • cpp/build/release/arrow-compute-vector-selection-test --gtest_filter='TestTakeKernelWithChunkedIndices.*' — passed.
  • cpp/build/release/arrow-compute-vector-selection-test — passed (168 tests).

Are there any user-facing changes?

No.

Was AI used for this PR?

In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

Return a typed empty result when the indices have no chunks, without
concatenating the values. Reuse the indices' chunk count for allocation
and iteration in the non-empty case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++][Compute] Avoid unnecessary work for empty chunked take indices

1 participant