Skip to content

Draft: SelectionSpan + 64-bit selection indices#72

Draft
zanmato1984 wants to merge 17 commits into
fix/gh-47376from
draft/selection-span
Draft

Draft: SelectionSpan + 64-bit selection indices#72
zanmato1984 wants to merge 17 commits into
fix/gh-47376from
draft/selection-span

Conversation

@zanmato1984

@zanmato1984 zanmato1984 commented May 7, 2026

Copy link
Copy Markdown
Owner

Addresses pitrou review feedback on apache#47377:

  • Use 64-bit indices for SelectionVector (UInt64).
  • Introduce SelectionSpan (ContiguousSpan / FilteredSpan / DiscreteSpan) and update selective_exec to take SelectionSpan.
  • Provide VisitSelectionSpanInline helper; ExecSpanIterator currently emits DiscreteSpan only.
  • Cast SelectionVector indices to int64 in dense gather/execute/scatter fallback since Scatter only accepts signed indices.

Local verification (macOS arm64, Debug):

  • Configured and built with CMake + Ninja
  • Ran unit tests with:
    • PYTHON=python3
    • ARROW_TEST_DATA=$PWD/testing/data (requires git submodule update --init testing)
    • ctest --test-dir cpp/build/selspan-debug -j 8 --output-on-failure (50/50 passed)

Introduce SelectionSpan (ContiguousSpan / FilteredSpan / DiscreteSpan) for the scalar kernel selective_exec API.

Currently ExecSpanIterator only emits DiscreteSpan, but VisitSelectionSpanInline allows kernels and tests to handle additional shapes incrementally.

Also cast SelectionVector indices to int64 in the dense gather/execute/scatter fallback since Scatter requires signed indices.
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

Remove SelectionVectorSpan, use DiscreteSpan directly, emit ContiguousSpan for contiguous selections, and simplify VisitSelectionSpanInline with overload visitors.
zanmato1984 added 11 commits May 8, 2026 02:24
- Hide selection backend behind PIMPL (indices/mask/ranges)

- Use backend-specific gather/scatter for selective dense fallback

- Normalize preallocation state + fix tests
- Deduplicate ApplySelectionMask for ArrayData/ArraySpan\n- Fix OUTPUT_NOT_NULL full-span validity init\n- Add unit test for OUTPUT_NOT_NULL selective exec
- Centralize SelectedCount/empty-span checks\n- Reduce scattered selection if/else in ScalarExecutor
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.

1 participant